Bing Web Search API doesn't accept percent-encoded commas in URL

Minh Duc Pham 0 Reputation points
2024-05-06T08:49:27.2633333+00:00

According to this documentation page of the Bing Web Search API:

Remember that you need to URL-encode all query parameters, so the parameter actually looks like:

`&responseFilter=webpages%2Cnews`

But when I did that, the search API returned this error:

$ curl "https://api.bing.microsoft.com/v7.0/search?q=aluminium&responseFilter=news%2Cwebpages"

{"_type": "ErrorResponse", "errors": [{"_type": "Error", "code": "InsufficientAuthorization", "message": "Insufficient authorization to access requested resource.", "moreDetails":"Only these values are allowed: Webpages,Images,Videos,News,SpellSuggestions,entities,places,RelatedSearches,Computation,TimeZone,Translations", "parameter": "responseFilter", "value": "news%2Cwebpages" }]}

Why is this the case?

Bing Web Search
Bing Web Search
A Bing service that gives you enhanced search details from billions of web documents.
146 questions
{count} votes

1 answer

Sort by: Most helpful
  1. dupammi 7,955 Reputation points Microsoft Vendor
    2024-05-07T03:00:51.6533333+00:00

    Hi @Minh Duc Pham

    Thak you for using the Microsoft Q&A forum.

    Based on my experience, I tried to reproduce the issue and found a solution to be specifying the responseFilter parameter without percent-encoding.

    I suggest you try using the responseFilter parameter without percent-encoding, as I did in below repro.

    curl "https://api.bing.microsoft.com/v7.0/search?q=aluminium&responseFilter=News,Webpages" -H "Ocp-Apim-Subscription-Key: YOUR_SUBSCRIPTION_KEY"
    

    Part of the Output:
    User's image

    This should resolve the issue and allow you to use multiple values for the responseFilter parameter.

    1 person found this answer helpful.
    0 comments No comments