Formation
Certification
Microsoft Certified : Azure AI Engineer Associate - Certifications
Concevez et mettez en œuvre une solution Azure AI à l’aide d’Azure AI Services, de Recherche Azure AI et d’Azure Open AI.
Ce navigateur n’est plus pris en charge.
Effectuez une mise à niveau vers Microsoft Edge pour tirer parti des dernières fonctionnalités, des mises à jour de sécurité et du support technique.
Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in JavaScript, the Bing Custom Search API is a RESTful web service compatible with most programming languages. The source code for this sample is available on GitHub.
A Bing Custom Search instance. For more information, see Quickstart: Create your first Bing Custom Search instance.
Create a new JavaScript file in your favorite IDE or editor, and add a require()
statement for the requests library. Create variables for your subscription key, custom configuration ID, and search term.
var request = require("request");
var subscriptionKey = 'YOUR-SUBSCRIPTION-KEY';
var customConfigId = 'YOUR-CUSTOM-CONFIG-ID';
var searchTerm = 'microsoft';
Create a variable to store the information being sent in your request. Construct the request URL by appending your search term to the q=
query parameter, and your search instance's custom configuration ID to the customconfig=
parameter. Separate the parameters with an ampersand (&
).
var info = {
url: 'https://api.bing.microsoft.com/v7.0/custom/search?' +
'q=' + searchTerm + "&" +
'customconfig=' + customConfigId,
headers: {
'Ocp-Apim-Subscription-Key' : subscriptionKey
}
}
Use the JavaScript request library to send a search request to your Bing Custom Search instance and print information about the results, including its name, url, and the date the webpage was last crawled.
request(info, function(error, response, body){
var searchResponse = JSON.parse(body);
for(var i = 0; i < searchResponse.webPages.value.length; ++i){
var webPage = searchResponse.webPages.value[i];
console.log('name: ' + webPage.name);
console.log('url: ' + webPage.url);
console.log('displayUrl: ' + webPage.displayUrl);
console.log('snippet: ' + webPage.snippet);
console.log('dateLastCrawled: ' + webPage.dateLastCrawled);
console.log();
}
Formation
Certification
Microsoft Certified : Azure AI Engineer Associate - Certifications
Concevez et mettez en œuvre une solution Azure AI à l’aide d’Azure AI Services, de Recherche Azure AI et d’Azure Open AI.
Documentation
Bing Custom Search API samples - Bing Search Services
Use the Bing Custom Search API samples to search your view of the web for webpages and more.
Quickstart: Call your Bing Custom Search endpoint using Python - Bing Search Services
Use this quickstart to begin requesting search results from your Bing Custom Search instance using Python.
Configure a hosted UI for Bing Custom Search - Bing Search Services
Use this article to configure and integrate a hosted UI for Bing Custom Search.