The news API does not set the language of results.

Lennard Dorst 0 Reputation points
2024-01-02T11:57:18.87+00:00

Hello,

I am trying to fetch news using the Bing News API- but cannot set the language. Even tho I have set the setLang parameter, the results are German. When I use a VPN to change my IP to a different country, the language changes. This made me think: Why is the language of outputs based on the IP that I do the request from?

Here is the API endpoint I am using:

https://api.bing.microsoft.com/v7.0/news/search?setLang=us-en?mkt=zh-CN

Any ideas on how to fix this issue?

  • Lennard
Bing News Search
Bing News Search
A Bing service that supports searching for news and get comprehensive results.
47 questions
{count} votes

1 answer

Sort by: Most helpful
  1. JananiRamesh-MSFT 23,256 Reputation points
    2024-01-02T13:11:28.09+00:00

    @Lennard Dorst Thanks for reaching out. In your API endpoint, you’re using setLang=us-en?mkt=zh-CN. The setLang parameter is used to set the user interface language, not the language of the search results. The mkt parameter is used to specify the market for the search results. If the mkt parameter is not specified, the API will infer the market from the IP address of the request.

    However, there seems to be a small mistake in your API endpoint. The correct format should be using an ampersand (&) to separate parameters, not a question mark (?). So, your API endpoint should look like this:

    https://api.bing.microsoft.com/v7.0/news/search?setLang=us-en&mkt=zh-CN

    This will set the user interface language to US English (us-en) and the market for the search results to China (zh-CN).

    I hope this helps! Let me know if you have any other questions.