Resource not found

John Wargo 31 Reputation points
2020-11-06T20:27:09.137+00:00

Like everyone else using the Bing Search API, I received an email from Azure telling me "Bing Search APIs will transition from Azure Cognitive Services to Azure Marketplace on 31 October 2023" I have a few questions about this change. In the email I received, it specifically lists the following services:

  • Bing Auto Suggest
  • Bing Custom Search
  • Bing Entity Search
  • Bing Spell Check
  • Bing Web Search

but I'm using Bing News Search.

I'm assuming News is included in the list of services, but I want to make sure. I created a Bing Resource in Azure and I'm trying to use it to search news using my new API keys and the code at https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingNewsSearchv7.js but when I connect to the service, I receive a Resource not found error with a 404 response code.

Here's my code:

const BING_KEY = Config.BING_ACCESS_KEY;  
const BING_HOST = "https://api.bing.microsoft.com/bing/v7.0/news/search";  
const BING_MARKET = 'en-US';  
const SEARCH_QUERY = 'pwa';  
  
 let request_params = {  
      method: 'GET',  
      uri: BING_HOST,  
      count: 20,  
      headers: { 'Ocp-Apim-Subscription-Key': BING_KEY },  
      qs: { q: SEARCH_QUERY, mkt: BING_MARKET },  
      json: true  
    }  
  
    // Call the Bing search API  
    request(request_params, (error: any, response: Response, body: any) => {  
      //@ts-ignore     
      console.log('statusCode:', response && response.statusCode);  
      if (error) console.error('error:', error);  
      //@ts-ignore  
      if (response && response.statusCode == 200) {  
        console.log('original query: ' + body.queryContext.originalQuery);  
      }  
      console.table(body);  
    });  


  
Bing News Search
Bing News Search
A Bing service that supports searching for news and get comprehensive results.
50 questions
0 comments No comments
{count} votes

Accepted answer
  1. Ramr-msft 17,741 Reputation points
    2020-11-09T10:16:59.447+00:00

    @John Wargo Thanks for the question, Please use the following endpoint BING_HOST = "https://api.bing.microsoft.com/v7.0/news/search" and find the below snapshot for the same.

    Please follow the below documentation for bing news search.

    https://learn.microsoft.com/en-us/bing/search-apis/bing-news-search/overview

    38250-image.png


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.