Skip to content

Commit bec25dc

Browse files
committed
adding extra object info
1 parent 1809728 commit bec25dc

File tree

1 file changed

+87
-26
lines changed

1 file changed

+87
-26
lines changed

articles/cognitive-services/bing-visual-search/concepts/sending-queries.md

Lines changed: 87 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ The following are the query parameters your request should specify. At a minimum
7272
| Name | Value | Type | Required |
7373
| --- | --- | --- | --- |
7474
| <a name="cc" />cc | A two-character country code that represents where the results come from.<br /><br /> If you set this parameter, you must also specify the [Accept-Language](#acceptlanguage) header. Bing uses the first supported language it finds from the list of languages, and combines the language with the country code that you specify to determine the market to return results from. If the languages list does not include a supported language, Bing finds the closest language and market that supports the request. Or it may use an aggregated or default market for the results instead of the specified one.<br /><br /> You should use this query parameter and the `Accept-Language` query parameter only if you specify multiple languages; otherwise, you should use the `mkt` and `setLang` query parameters.<br /><br /> This parameter and the [mkt](#mkt) query parameter are mutually exclusive&mdash;do not specify both. | String | No |
75-
| <a name="enableEntityData" />enableEntityData | A `true` or `false` value. Setting this value to `true` returns detailed information on the main entity in the image you upload, including links to the web and attribution information. <br /><br /> This parameter is set to `false` by default. | Boolean | No |
7675
| <a name="mkt" />mkt | The market where the results come from. <br /><br /> **NOTE:** You should always specify the market, if known. Specifying the market helps Bing route the request and return an appropriate and optimal response.<br /><br /> This parameter and the [cc](#cc) query parameter are mutually exclusive&mdash;do not specify both. | String | Yes |
7776
| <a name="safesearch" />safeSearch | A filter for adult content. The following are the possible case-insensitive filter values.<br /><ul><li>Off&mdash;Return webpages with adult text or images.<br /><br/></li><li>Moderate&mdash;Return webpages with adult text, but not adult images.<br /><br/></li><li>Strict&mdash;Do not return webpages with adult text or images.</li></ul><br /> The default is Moderate.<br /><br /> **NOTE:** If the request comes from a market that Bing's adult policy requires that `safeSearch` be set to Strict, Bing ignores the `safeSearch` value and uses Strict.<br/><br/>**NOTE:** If you use the `site:` query operator, there is a chance that the response may contain adult content regardless of what the `safeSearch` query parameter is set to. Use `site:` only if you are aware of the content on the site and your scenario supports the possibility of adult content. | String | No |
7877
| <a name="setlang" />setLang | The language to use for user interface strings. Specify the language using the ISO 639-1 two-letter language code. For example, the language code for English is EN. The default is EN (English).<br /><br /> Although optional, you should always specify the language. Typically, you set `setLang` to the same language specified by `mkt` unless the user wants the user interface strings displayed in a different language.<br /><br /> This parameter and the [Accept-Language](#acceptlanguage) header are mutually exclusive&mdash;do not specify both.<br /><br /> A user interface string is a string that's used as a label in a user interface. There are few user interface strings in the JSON response objects. Also, any links to Bing.com properties in the response objects apply the specified language. | String | No |
@@ -118,6 +117,24 @@ Content-Disposition: form-data; name="knowledgeRequest"
118117
--boundary_1234-abcd--
119118
```
120119

120+
You can optionally set the `enableEntityData` attribute in the header to `true` for detailed information on the main entity in the image you upload, including links to the web and attribution information. This field is `false` by default.
121+
122+
```
123+
--boundary_1234-abcd
124+
Content-Disposition: form-data; name="knowledgeRequest"
125+
126+
{
127+
"imageInfo" : {
128+
"url" : "https://contoso.com/2018/05/fashion/red.jpg"
129+
}
130+
"invokedSkillsRequestData" : {
131+
"enableEntityData" : true
132+
}
133+
}
134+
135+
--boundary_1234-abcd--
136+
```
137+
121138
If you upload a local image, the following snippet shows the form data you must include in the body of the POST. The form data must include the `Content-Disposition` header. Its `name` parameter must be set to "image" and the `filename` parameter may be set to any string. The `Content-Type` header may be set to any commonly used image mime type. The contents of the form is the binary data of the image. The maximum image size you may upload is 1 MB. The largest of the width or height should be 1,500 pixels or less.
122139

123140
```
@@ -365,37 +382,81 @@ Text recognition can also recognize the contact information on business cards, s
365382
}
366383
```
367384

368-
If the image contains a recognized entity such as a culturally well-known/popular person, place, or thing, one of the tags may include an Entity insight.
385+
If the image contains a recognized entity such as a culturally well-known/popular person, place, or thing, one of the tags may include an Entity insight. The `mainEntity` and `data` fields are only available if the `enableEntityData` attribute in the `Content-Type` header is set to `true`.
369386

370387
```json
388+
{
389+
"image" : {
390+
"thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?q=Statue+of+Liberty..."
391+
},
392+
"displayName" : "Statue of Liberty",
393+
"boundingBox" : {
394+
"queryRectangle" : {
395+
"topLeft" : {"x" : 0.40625, "y" : 0.1757813},
396+
"topRight" : {"x" : 0.6171875, "y" : 0.1757813},
397+
"bottomRight" : {"x" : 0.6171875, "y" : 0.3867188},
398+
"bottomLeft" : {"x" : 0.40625, "y" : 0.3867188}
399+
},
400+
"displayRectangle" : {
401+
"topLeft" : {"x" : 0.40625, "y" : 0.1757813},
402+
"topRight" : {"x" : 0.6171875, "y" : 0.1757813},
403+
"bottomRight" : {"x" : 0.6171875, "y" : 0.3867188},
404+
"bottomLeft" : {"x" : 0.40625, "y" : 0.3867188}
405+
}
406+
},
407+
"actions" : [
371408
{
372-
"image" : {
373-
"thumbnailUrl" : "https:\/\/tse4.mm.bing.net\/th?q=Statue+of+Liberty..."
374-
},
409+
"_type" : "ImageEntityAction",
410+
"webSearchUrl" : "https:\/\/www.bing.com\/search?q=Statue+of+Liberty",
375411
"displayName" : "Statue of Liberty",
376-
"boundingBox" : {
377-
"queryRectangle" : {
378-
"topLeft" : {"x" : 0.40625, "y" : 0.1757813},
379-
"topRight" : {"x" : 0.6171875, "y" : 0.1757813},
380-
"bottomRight" : {"x" : 0.6171875, "y" : 0.3867188},
381-
"bottomLeft" : {"x" : 0.40625, "y" : 0.3867188}
382-
},
383-
"displayRectangle" : {
384-
"topLeft" : {"x" : 0.40625, "y" : 0.1757813},
385-
"topRight" : {"x" : 0.6171875, "y" : 0.1757813},
386-
"bottomRight" : {"x" : 0.6171875, "y" : 0.3867188},
387-
"bottomLeft" : {"x" : 0.40625, "y" : 0.3867188}
388-
}
412+
"actionType" : "Entity",
413+
"mainEntity" : {
414+
"name" = "Statue of liberty",
415+
"bingId" : "..."
389416
},
390-
"actions" : [
391-
{
392-
"_type" : "ImageEntityAction",
393-
"webSearchUrl" : "https:\/\/www.bing.com\/search?q=Statue+of+Liberty",
394-
"displayName" : "Statue of Liberty",
395-
"actionType" : "Entity",
417+
"data" : {
418+
"id" : "https://api.cognitive.microsoft.com/api/v7/entities/...",
419+
"readLink": "https://www.bingapis.com/api/v7/search?q=...",
420+
"readLinkPingSuffix": "...",
421+
"contractualRules": [
422+
{
423+
"_type": "ContractualRules/LicenseAttribution",
424+
"targetPropertyName": "description",
425+
"mustBeCloseToContent": true,
426+
"license": {
427+
"name": "CC-BY-SA",
428+
"url": "http://creativecommons.org/licenses/by-sa/3.0/",
429+
"urlPingSuffix": "..."
430+
},
431+
"licenseNotice": "Text under CC-BY-SA license"
432+
},
433+
{
434+
"_type": "ContractualRules/LinkAttribution",
435+
"targetPropertyName": "description",
436+
"mustBeCloseToContent": true,
437+
"text": "Wikipedia",
438+
"url": "http://en.wikipedia.org/wiki/...",
439+
"urlPingSuffix": "..."
440+
}
441+
],
442+
"webSearchUrl": "https://www.bing.com/entityexplore?q=...",
443+
"webSearchUrlPingSuffix": "...",
444+
"name": "Statue of Liberty",
445+
"image": {
446+
"thumbnailUrl": "https://tse1.mm.bing.net/th?id=...",
447+
"hostPageUrl": "http://upload.wikimedia.org/wikipedia/...",
448+
"hostPageUrlPingSuffix": "...",
449+
"width": 50,
450+
"height": 50,
451+
"sourceWidth": 474,
452+
"sourceHeight": 598
453+
},
454+
"description" : "...",
455+
"bingId": "..."
396456
}
397-
]
398-
}
457+
}
458+
]
459+
}
399460
```
400461

401462
## See also

0 commit comments

Comments
 (0)