I was able to connect and setup Bing custom search. My question is how to get the following 10 results? And is it possible to get more than 10 results in one request?
var subscriptionKey = "My Key";
var customConfigId = "My ID";
var searchTerm = "test";
var url = "https://api.bing.microsoft.com/v7.0/custom/search?q=" + searchTerm + "&customconfig=" + customConfigId + "&mkt=en-US";
var client = new HttpClient();
System.Net.ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
client.DefaultRequestHeaders.Add("Ocp-Apim-Subscription-Key", subscriptionKey);
var httpResponseMessage = client.GetAsync(url).Result;
var responseContent = httpResponseMessage.Content.ReadAsStringAsync().Result;
BingCustomSearchResponse response = JsonConvert.DeserializeObject<BingCustomSearchResponse>(responseContent);
for (int i = 0; i < response.webPages.value.Length; i++)
{
var webPage = response.webPages.value[i];
}
Add count parameter to the URL https://api.bing.microsoft.com/v7.0/custom/search?q=microsoft&customconfig=***&count=20 and API returns results as per the count value.
Kindly refer https://learn.microsoft.com/en-us/bing/search-apis/bing-custom-search/reference/query-parameters