You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/cognitive-services/bing-visual-search/quickstarts/csharp.md
+15-15Lines changed: 15 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-visual-search
11
11
ms.topic: quickstart
12
-
ms.date: 12/17/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: scottwhi
14
14
---
15
15
16
16
# Quickstart: Get image insights using the Bing Visual Search REST API and C#
17
17
18
-
This quickstart demonstrates how to upload an image to the Bing Visual Search API and to view the insights that it returns.
18
+
This quickstart demonstrates how to upload an image to the Bing Visual Search API and view the insights that it returns.
19
19
20
20
## Prerequisites
21
21
@@ -37,7 +37,7 @@ This quickstart demonstrates how to upload an image to the Bing Visual Search AP
37
37
usingSystem.Collections.Generic;
38
38
```
39
39
40
-
2. Addvariablesfor your subscription key, endpoint, and path to the image you want to upload. `uriBase` can be the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpointdisplayedintheAzureportalfor your resource:
40
+
2. Addvariablesfor your subscription key, endpoint, and path to the image you want to upload. You can use the value of `uriBase` in the following code for the global endpoint, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpointdisplayedintheAzureportalfor your resource:
41
41
42
42
```csharp
43
43
const string accessKey = "<my_subscription_key>";
@@ -65,7 +65,7 @@ This quickstart demonstrates how to upload an image to the Bing Visual Search AP
@@ -187,9 +187,9 @@ To upload a local image, you first build the form data to send to the API. The f
187
187
188
188
## Using HttpClient
189
189
190
-
Ifyouuse `HttpClient`, youcanusethe `MultipartFormDataContent` classto build the form data. Just use the following sections of code to replace the corresponding methods in the previous example.
190
+
Ifyouuse `HttpClient`, youcanusethe `MultipartFormDataContent` classto build the form data. Use the following sections of code to replace the corresponding methods in the previous example.
191
191
192
-
Replace the `Main` method with this code:
192
+
Replace the `Main()` method with this code:
193
193
194
194
```csharp
195
195
staticvoidMain()
@@ -229,7 +229,7 @@ Replace the `Main` method with this code:
229
229
}
230
230
```
231
231
232
-
Replace the `BingImageSearch` method with this code:
232
+
Replace the `BingImageSearch()` method with this code:
Copy file name to clipboardExpand all lines: articles/cognitive-services/bing-visual-search/quickstarts/go.md
+15-5Lines changed: 15 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,7 +9,7 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-visual-search
11
11
ms.topic: quickstart
12
-
ms.date: 12/17/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: aahi
14
14
---
15
15
@@ -20,13 +20,13 @@ This quickstart uses the Go programming language to call the Bing Visual Search
20
20
## Prerequisites
21
21
22
22
* Install the [Go binaries](https://golang.org/dl/).
23
-
* The go-spew deep pretty printeris used to display results. You can install go-spew with the `$ go get -u https://github.com/davecgh/go-spew` command.
23
+
* The go-spew deep pretty printer, which is used to display results. Install go-spew with the `$ go get -u https://github.com/davecgh/go-spew` command.
Create a Go project in your IDE or editor. Then import `net/http` for requests, `ioutil` to read the response, and `encoding/json` to handle the JSON text of results. The `go-spew` library is used to parse JSON results.
29
+
Create a Go project in your IDE or editor. Then, import `net/http` for requests, `ioutil` to read the response, and `encoding/json` to handle the JSON text of results. Use the `go-spew` library to parse JSON results.
30
30
31
31
```go
32
32
package main
@@ -105,7 +105,12 @@ type BingAnswer struct {
105
105
106
106
## Main function and variables
107
107
108
-
The following code declares the main function and assigns required variables. Confirm that the endpoint is correct and replace the `token` value with a valid subscription key from your Azure account. The `batchNumber` is a GUID required for leading and trailing boundaries of the POST data. The `fileName` variable identifies the image file for the POST. `endpoint` can be the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource:
108
+
The following code declares the main function and assigns the required variables:
109
+
110
+
1. Confirm that the endpoint is correct and replace the `token` value with a valid subscription key from your Azure account.
111
+
2. For `batchNumber`, assign a GUID, which is required for the leading and trailing boundaries of the POST data.
112
+
3. For `fileName`, assign the image file to use for the POST.
113
+
4. For `endpoint`, you can use the global endpoint in the following code, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
109
114
110
115
```go
111
116
funcmain() {
@@ -155,7 +160,12 @@ func main() {
155
160
156
161
## Boundaries of POST body
157
162
158
-
A POST request to the Visual Search endpoint requires leading and trailing boundaries enclosing the POST data. The leading boundary includes a batch number, the content type identifier `Content-Disposition: form-data; name="image"; filename=`, plus the filename of the image to POST. The trailing boundary is simply the batch number. These functions are not included in the `main` block:
163
+
A POST request to the Visual Search endpoint requires leading and trailing boundaries to enclose the POST data. These functions aren't included in the `main()` block.
164
+
165
+
The leading boundary includes a batch number, the content type identifier `Content-Disposition: form-data; name="image"; filename=`, and the filename of the image to POST.
166
+
167
+
The trailing boundary includes the batch number only.
Copy file name to clipboardExpand all lines: articles/cognitive-services/bing-visual-search/quickstarts/java.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-visual-search
11
11
ms.topic: quickstart
12
-
ms.date: 12/17/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: scottwhi
14
14
---
15
15
16
16
# Quickstart: Get image insights using the Bing Visual Search REST API and Java
17
17
18
-
Use this quickstart to make your first call to the Bing Visual Search API and view the results. This Java application uploads an image to the API and displays the information it returns. Though this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
18
+
Use this quickstart to make your first call to the Bing Visual Search API. This Java application uploads an image to the API and displays the information it returns. Although this application is written in Java, the API is a RESTful Web service compatible with most programming languages.
19
19
20
20
## Prerequisites
21
21
@@ -48,7 +48,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
2.Create variables for your API endpoint, subscription key, and the path to your image. `endpoint` can be the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource:
51
+
2.Create variables for your API endpoint, subscription key, and the path to your image. You can use the value of `endpoint` in the following code forthe global endpoint, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource:
@@ -57,7 +57,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
57
57
```
58
58
59
59
60
-
When you upload a local image, the form data must include the `Content-Disposition` header. You must set its `name` parameter to "image", and you can set the `filename` parameter to any string. The contents of the form include the binary data of the image. The maximum image size you can upload is 1MB.
60
+
3.When you upload a local image, the form data must include the `Content-Disposition` header. Setits `name` parameter to "image", and set the `filename` parameter to any string. The contents of the form include the binary data of the image. The maximum image size you can upload is 1MB.
61
61
62
62
```
63
63
--boundary_1234-abcd
@@ -70,7 +70,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
70
70
71
71
## Create the JSON parser
72
72
73
-
Create a method to make the JSON response from the API more readable using `JsonParser`:
73
+
Create a method to make the JSON response from the API more readable by using `JsonParser`:
Copy file name to clipboardExpand all lines: articles/cognitive-services/bing-visual-search/quickstarts/nodejs.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-visual-search
11
11
ms.topic: quickstart
12
-
ms.date: 12/17/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: scottwhi
14
14
---
15
15
16
16
# Quickstart: Get image insights using the Bing Visual Search REST API and Node.js
17
17
18
-
Use this quickstart to make your first call to the Bing Visual Search API and view the search results. This simple JavaScript application uploads an image to the API, and displays the information returned about it. While this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages.
18
+
Use this quickstart to make your first call to the Bing Visual Search API. This simple JavaScript application uploads an image to the API, and displays the information returned about it. Although this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages.
19
19
20
20
## Prerequisites
21
21
@@ -35,7 +35,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
35
35
var fs =require('fs');
36
36
```
37
37
38
-
2. Create variables for your API endpoint, subscription key, and the path to your image. `baseUri`can be the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource:
38
+
2. Create variables for your API endpoint, subscription key, and the path to your image. You can use the value of`baseUri`in the following code forthe global endpoint, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource:
39
39
40
40
```javascript
41
41
var baseUri = 'https://api.cognitive.microsoft.com/bing/v7.0/images/visualsearch';
@@ -53,7 +53,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
53
53
54
54
## Construct and send the search request
55
55
56
-
When uploading a local image, the form data must include the `Content-Disposition`header. You must set its `name` parameter to "image", and the `filename` parameter can be set to any string. The contents of the form include the binary data of the image. The maximum image size you may upload is 1MB.
56
+
When you upload a local image, the form data must include the `Content-Disposition`header. Setits `name` parameter to "image", and set the `filename` parameter to any string. The contents of the form include the binary data of the image. The maximum image size you can upload is 1MB.
2. Use the request library to upload the image, and call `requestCallback()` to print the response. Be sure to add your subscription key to the request header:
74
+
2. Use the request library to upload the image, and call `requestCallback()` to print the response. Add your subscription key to the request header:
Copy file name to clipboardExpand all lines: articles/cognitive-services/bing-visual-search/quickstarts/python.md
+6-6Lines changed: 6 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,13 +9,13 @@ manager: nitinme
9
9
ms.service: cognitive-services
10
10
ms.subservice: bing-visual-search
11
11
ms.topic: quickstart
12
-
ms.date: 12/17/2019
12
+
ms.date: 05/19/2020
13
13
ms.author: scottwhi
14
14
---
15
15
16
16
# Quickstart: Get image insights using the Bing Visual Search REST API and Python
17
17
18
-
Use this quickstart to make your first call to the Bing Visual Search API and view the results. This Python application uploads an image to the API and displays the information it returns. Though this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
18
+
Use this quickstart to make your first call to the Bing Visual Search API. This Python application uploads an image to the API and displays the information it returns. Although this application is written in Python, the API is a RESTful Web service compatible with most programming languages.
19
19
20
20
## Prerequisites
21
21
@@ -31,7 +31,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
31
31
import requests, json
32
32
```
33
33
34
-
2. Create variables for your subscription key, endpoint, and the path to the image you're uploading. `BASE_URI` can be the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource:
34
+
2. Create variables for your subscription key, endpoint, and the path to the image you're uploading. You can use the value of `BASE_URI` in the following code for the global endpoint, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
35
35
36
36
```python
37
37
@@ -40,7 +40,7 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
40
40
imagePath = 'your-image-path'
41
41
```
42
42
43
-
When you upload a local image, the form data must include the `Content-Disposition` header. You must setits `name` parameter to "image", and you canset the `filename` parameter to any string. The contents of the form include the binary data of the image. The maximum image size you can upload is1MB.
43
+
3. When you upload a local image, the form data must include the `Content-Disposition` header. Set its `name` parameter to "image", andset the `filename` parameter to any string. The contents of the form include the binary data of the image. The maximum image size you can upload is1MB.
44
44
45
45
```
46
46
--boundary_1234-abcd
@@ -51,13 +51,13 @@ Use this quickstart to make your first call to the Bing Visual Search API and vi
51
51
--boundary_1234-abcd--
52
52
```
53
53
54
-
3. Create a dictionary object to hold your request's header information. Bind your subscription key to the string `Ocp-Apim-Subscription-Key`, as shown below:
54
+
4. Create a dictionary object to hold your request's header information. Bind your subscription key to the string `Ocp-Apim-Subscription-Key`:
0 commit comments