Does the Bing Search API demo key have any limitations?

R SaiLight 1 Reputation point
2020-08-04T08:49:28.447+00:00

Does the Bing Search API (images) demo key have any limitations? On the test page (https://azure.microsoft.com/ru-ru/services/cognitive-services/bing-image-search-api/), the search phrase produces a lot of results, but in my script there are no results at all. Here is the script itself:

function getImages($query) {
    $query = str_replace(' ', '+', $query);
    $url = 'https://api.cognitive.microsoft.com/bing/v7.0/images/search?q=' . $query . '&safesearch=strict';
    $curl = curl_init();

    curl_setopt($curl, CURLOPT_URL, $url); 
    curl_setopt($curl, CURLOPT_TIMEOUT, '1'); 
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($curl, CURLOPT_HTTPHEADER, array(
        'Content-Type: multipart/form-data',
        'Ocp-Apim-Subscription-Key: KEY'
    ));

    $result = curl_exec($curl);
    $result = json_decode($result, true);

    return $result['value'];
}
Bing Image Search
Bing Image Search
A Bing service that supports searching for images and gets comprehensive results.
44 questions
{count} votes

1 answer

Sort by: Most helpful
  1. GiftA-MSFT 11,151 Reputation points
    2020-08-05T01:42:27.717+00:00

    Hi, unless you've exhausted your quota limits for the month, you should be able to view results. Can you try the following sample python code or submit your request using Postman? Let me know if you have any further questions or concerns. Thanks.

    import requests
    
    url = "https://westus.api.cognitive.microsoft.com/bing/v7.0/images/search?q='abstract art'"
    
    headers = {
      'Ocp-Apim-Subscription-Key': '<key>'
    }
    
    response = requests.request("GET", url, headers=headers)
    
    response.json()
    
    0 comments No comments