javaazurebing-apibing-search

Bing Visual Search API (v7) returns no response for image


I tried to setup a bing visual search API REST-Call from my java program. It works partly, i get an answer but not the answer i want. The goal is to do a POST REST-Call with an image and then get the information about the image as JSON.

I setup everything in the azure portal: firstly bing-search v7 with an resource group and a resource. After that i got my API-Key which seems to work. I also followed the quickstart guide https://learn.microsoft.com/en-us/azure/cognitive-services/bing-visual-search/quickstarts/java, but nonetheless i still don't get the expected response.

My code is exactly the same as in the quickstarts guide except for the image path.

I tested my API-Key here, which is a site for testing the API call, there is also an example of an Response i would expect, for example pages including that images and so on https://dev.cognitive.microsoft.com/docs/services/878c38e705b84442845e22c7bff8c9ac/operations/124f9090e80447b1985f881e.

My Response looks like this:

{
  "_type": "ImageKnowledge",
  "instrumentation": {
    "_type": "ResponseInstrumentation",
    "pingUrlBase": "https:\/\/www.bingapis.com\/api\/ping?IG=CB7D2E4D02B7453CA95C71AB55548271&CID=33CBAFA2BC1D6CF829C9A2DDBD516D7A&ID=",
    "pageLoadPingUrl": "https:\/\/www.bingapis.com\/api\/ping\/pageload?IG=CB7D2E4D02B7453CA95C71AB55548271&CID=33CBAFA2BC1D6CF829C9A2DDBD516D7A&Type=Event.CPT&DATA=0"
  },
  "tags": [{
    "displayName": "",
    "actions": [{
      "actionType": "MoreSizes"
    }, {
      "actionType": "ImageById"
    }]
  }],
  "image": {
    "imageInsightsToken": "bcid_COGc070ee574e85498c8b0b6cec557121cd*ccid_9619671840e76c8e5b5c33e002742ac7*thid_OSBI.COGc070ee574e85498c8b0b6cec557121cd"
  }
}

Solution

  • I found an ugly workaround. I upload the image to a filehoster and get a URL. The URL returns a result via the Bing Vision API. I'm also using the Bing Java SDK for azure, which can be found on github.