Error in Bing Search API

228 views Asked by At

I am using the new Bing Search API v.5 in my app (javascript).

This is the query: "31 'Jerry Willemse' netherlands 'intercop'"

If I access the Bing Search API from within my app I get zero results.

If I use the test tool available here: https://dev.cognitive.microsoft.com/docs/services/56b43eeccf5ff8098cef3807/operations/56b4447dcf5ff8098cef380d/console

I get several results.

The test tool should precisely mimic the behavior of the API.

This is the URL generated by the API test tool

https://api.cognitive.microsoft.com/bing/v5.0/search?q='jerry willemse' netherlands 'intercop' 31&count=10&offset=0&mkt=en-us&safesearch=Moderate

Can URLs include spaces?

1

There are 1 answers

1
Claim Yang On

In fact, urls cannot include spaces. You can replace spaces with '%20' or '+'. Here are some useful ones:

+   %2B   

space %20 

/   %2F     

?   %3F     

%  %25     

#   %23     

&   %26     

=   %3D

You can also use function encodeURI(URIstring) provided by javascript to do replacing.