What are the extra headers in my bing image search API response?

Mike Ubezzi 2,776 Reputation points
2020-05-13T00:38:50.09+00:00

"I am seeing the following headers in my bing image search API.

X-MSEdge-ClientID  
BingAPIs-Market  
BingAPIs-TraceId  

What is the significance of these fields and how do we interpret them?"

[Note: As we migrate from MSDN, this question has been posted by an Azure Cloud Engineer as a frequently asked question] Source: MicrosoftDocs

Bing Image Search
Bing Image Search
A Bing service that supports searching for images and gets comprehensive results.
44 questions
0 comments No comments
{count} votes

Accepted answer
  1. Rohit Mungi 801 Reputation points
    2020-05-13T09:16:09.53+00:00

    The following headers may occur in responses from the Bing Image Search API.

    X-MSEdge-ClientID: The unique ID that Bing has assigned to the user  
    BingAPIs-Market: The market that was used to fulfill the request  
    BingAPIs-TraceId: The log entry on the Bing API server for this request (for support)  
    

    It is particularly important to persist the client ID and return it with subsequent requests. When you do this, the search will use past context in ranking search results and also provide a consistent user experience.

    However, when you call the Bing Image Search API from JavaScript, your browser's built-in security features (CORS) might prevent you from accessing the values of these headers.

    To gain access to the headers, you can make the Bing Image Search API request through a CORS proxy. The response from such a proxy has an Access-Control-Expose-Headers header that whitelists response headers and makes them available to JavaScript.

    The steps to install the same are available at the link below:

    https://learn.microsoft.com/en-us/azure/cognitive-services/bing-image-search/bing-image-search-resource-faq#response-headers-in-javascript

    Source: Azure Documentation


0 additional answers

Sort by: Most helpful