Skip to content

Commit 71c319b

Browse files
author
dksimpson
committed
Refresh Bing Autosuggest API quickstarts
1 parent 160d133 commit 71c319b

File tree

7 files changed

+51
-51
lines changed

7 files changed

+51
-51
lines changed

articles/cognitive-services/Bing-Autosuggest/quickstarts/csharp.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
---
22
title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and C#"
33
titleSuffix: Azure Cognitive Services
4-
description: Learn how to quickly start suggesting search terms in real-time with the Bing Autosuggest API.
4+
description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

99
ms.service: cognitive-services
1010
ms.subservice: bing-autosuggest
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/06/2020
1313
ms.author: aahi
1414
---
1515
# Quickstart: Suggest search queries with the Bing Autosuggest REST API and C#
1616

17-
Use this quickstart to begin making calls to the Bing Autosuggest API and getting the JSON response. This simple C# application sends a partial search query to the API, and returns suggestions for searches. While this application is written in C#, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingAutosuggestv7.cs).
17+
Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple C# application sends a partial search query to the API, and returns suggestions for searches. While this application is written in C#, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingAutosuggestv7.cs).
1818

1919
## Prerequisites
2020

2121
* Any edition of [Visual Studio 2017 or later](https://www.visualstudio.com/downloads/).
22-
* If you are using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
22+
* If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
2323

2424
[!INCLUDE [cognitive-services-bing-news-search-signup-requirements](../../../../includes/cognitive-services-bing-autosuggest-signup-requirements.md)]
2525

@@ -35,7 +35,7 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
3535
using System.Text;
3636
```
3737

38-
2. In a new class, create variables for your API host and path, [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a partial search query. You can use 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. In a new class, create variables for your API host and path, [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a partial search query. 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.
3939
4040
```csharp
4141
static string host = "https://api.cognitive.microsoft.com";

articles/cognitive-services/Bing-Autosuggest/quickstarts/java.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
---
22
title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Java"
33
titleSuffix: Azure Cognitive Services
4-
description: Learn how to quickly start suggesting search terms in real-time with the Bing Autosuggest API.
4+
description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

99
ms.service: cognitive-services
1010
ms.subservice: bing-autosuggest
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/06/2020
1313
ms.author: aahi
1414
---
1515

1616
# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Java
1717

18-
19-
Use this quickstart to begin making calls to the Bing Autosuggest API and getting the JSON response. This simple Java application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Java, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingAutosuggestv7.java)
18+
Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Java application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Java, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/java/Search/BingAutosuggestv7.java)
2019

2120
## Prerequisites
2221

@@ -40,7 +39,7 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
4039
import com.google.gson.JsonParser;
4140
```
4241

43-
2. Create variables for your subscription key, the API host and path, your [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a search query. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
42+
2. Create variables for your subscription key, the API host and path, your [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a search query. Use the global endpoint below, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
4443

4544
```java
4645
static String subscriptionKey = "enter key here";
@@ -69,7 +68,7 @@ public static String prettify(String json_text) {
6968
7069
1. Create a new method named `get_suggestions()` and perform the following steps:
7170
72-
1. construct the URL for your request by combining your API host, path, and encoding your search query. Be sure to url-encode the query before appending it. Create a parameters string for your query by appending the market code to the `mkt=` parameter, and your query to the `q=` parameter.
71+
1. Construct the URL for your request by combining your API host, path, and encoding your search query. Be sure to url-encode the query before appending it. Create a parameters string for your query by appending the market code to the `mkt=` parameter, and your query to the `q=` parameter.
7372
7473
```java
7574
@@ -80,7 +79,7 @@ public static String prettify(String json_text) {
8079
}
8180
```
8281
83-
2. Create a new URL for the request with the API host, path, and parameters created above.
82+
2. Create a new URL for the request with the API host, path, and parameters that you created in the previous step.
8483
8584
```java
8685
//...
@@ -99,7 +98,7 @@ public static String prettify(String json_text) {
9998
//...
10099
```
101100
102-
4. Read in the API response to a `StringBuilder`. After the response has been captured, close the `InputStreamReader` stream, and return the response.
101+
4. Store the API response in `StringBuilder`. After the response has been captured, close the `InputStreamReader` stream, and return the response.
103102
104103
```java
105104
//...
@@ -115,7 +114,7 @@ public static String prettify(String json_text) {
115114
return response.toString();
116115
```
117116
118-
2. In the main function of your application, call `get_suggestions()`, and print the response using `prettify()`.
117+
2. In the main function of your application, call `get_suggestions()`, and print the response by using `prettify()`.
119118
120119
```java
121120
public static void main(String[] args) {

articles/cognitive-services/Bing-Autosuggest/quickstarts/nodejs.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Node.js"
33
titleSuffix: Azure Cognitive Services
4-
description: Learn how to quickly start suggesting search terms in real-time with the Bing Autosuggest API.
4+
description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

99
ms.service: cognitive-services
1010
ms.subservice: bing-autosuggest
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/06/2020
1313
ms.author: aahi
1414
---
1515

1616
# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Node.js
1717

18-
Use this quickstart to begin making calls to the Bing Autosuggest API and getting the JSON response. This simple Node.js application sends a partial search query to the API, and returns suggestions for searches. While this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingAutosuggestv7.js)
18+
Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Node.js application sends a partial search query to the API, and returns suggestions for searches. While this application is written in JavaScript, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/nodejs/Search/BingAutosuggestv7.js)
1919

2020
## Prerequisites
2121

@@ -33,7 +33,7 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
3333
let https = require ('https');
3434
```
3535

36-
2. Create variables for the API endpoint host and path, your subscription key, [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a search term. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
36+
2. Create variables for the API endpoint host and path, your subscription key, [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a search term. 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.
3737

3838
```javascript
3939
// Replace the subscriptionKey string value with your valid subscription key.
@@ -48,7 +48,7 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
4848

4949
## Construct the search request and query.
5050

51-
1. Create a parameters string for your query by appending the market code to the `mkt=` parameter, and your query to the `q=` parameter.
51+
1. Create a parameters string for your query by appending the market code to the `mkt=` parameter, and your query to the `&q=` parameter.
5252

5353
```javascript
5454
let params = '?mkt=' + mkt + '&q=' + query;
@@ -70,17 +70,18 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
7070
}
7171
```
7272
73-
1. In the same function, use the request library to send your query to the API. `response_handler` will be defined in the next section.
73+
1. In the same function, use the request library to send your query to the API. `response_handler` is defined in the next section.
7474
75-
```javascript
75+
```javascript
7676
//...
7777
let req = https.request(request_params, response_handler);
7878
req.end();
7979
```
8080
8181
## Create a search handler
8282
83-
1. define a function named `response_handler` that takes an HTTP call, `response`, as a parameter. Do the following steps within this function:
83+
1. Define a function named `response_handler` that takes an HTTP call, `response`, as a parameter.
84+
Do the following steps within this function:
8485
8586
1. Define a variable to contain the body of the JSON response.
8687
@@ -90,15 +91,15 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
9091
};
9192
```
9293
93-
2. Store the body of the response when the **data** flag is called
94+
2. Store the body of the response when the `data` flag is called
9495
9596
```javascript
9697
response.on ('data', function (d) {
9798
body += d;
9899
});
99100
```
100101
101-
3. When an **end** flag is signaled, user `JSON.parse()` and `JSON.stringify()` to print the response.
102+
3. When an `end` flag is signaled, use `JSON.parse()` and `JSON.stringify()` to print the response.
102103
103104
```javascript
104105
response.on ('end', function () {

articles/cognitive-services/Bing-Autosuggest/quickstarts/php.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
---
22
title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and PHP"
33
titleSuffix: Azure Cognitive Services
4-
description: Learn how to quickly start suggesting search terms in real-time with the Bing Autosuggest API.
4+
description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

99
ms.service: cognitive-services
1010
ms.subservice: bing-autosuggest
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/06/2020
1313
ms.author: aahi
1414
---
1515

1616
# Quickstart: Suggest search queries with the Bing Autosuggest REST API and PHP
1717

18-
Use this quickstart to begin making calls to the Bing Autosuggest API and getting the JSON response. This simple PHP application sends a partial search query to the API, and returns suggestions for searches. While this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
18+
Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple PHP application sends a partial search query to the API, and returns suggestions for searches. While this application is written in PHP, the API is a RESTful Web service compatible with most programming languages.
1919

2020
## Prerequisites
2121

@@ -27,8 +27,8 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
2727

2828
1. Create a new PHP project in your favorite IDE.
2929
2. Add the code provided below.
30-
3. Replace the `subscriptionKey` value with an access key valid for your subscription.
31-
4. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
30+
3. Replace the `subscriptionKey` value with an access key that's valid for your subscription.
31+
4. Use the global endpoint in the code, or use the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
3232
5. Run the program.
3333

3434
```php
@@ -76,7 +76,7 @@ echo json_encode (json_decode ($result), JSON_PRETTY_PRINT);
7676
?>
7777
```
7878

79-
### Response
79+
## Example JSON response
8080

8181
A successful response is returned in JSON, as shown in the following example:
8282

articles/cognitive-services/Bing-Autosuggest/quickstarts/python.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
---
22
title: "Quickstart: Suggest search queries with the Bing Autosuggest REST API and Python"
33
titleSuffix: Azure Cognitive Services
4-
description: Learn how to quickly start suggesting search terms in real-time with the Bing Autosuggest API.
4+
description: Learn how to quickly start suggesting search terms in real time with the Bing Autosuggest API.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

99
ms.service: cognitive-services
1010
ms.subservice: bing-autosuggest
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/06/2020
1313
ms.author: aahi
1414
---
1515
# Quickstart: Suggest search queries with the Bing Autosuggest REST API and Python
1616

17-
Use this quickstart to begin making calls to the Bing Autosuggest API and getting the JSON response. This simple Python application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Python, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingAutosuggestv7.py)
17+
Follow this quickstart to learn how to make calls to the Bing Autosuggest API and read the JSON response. This simple Python application sends a partial search query to the API, and returns suggestions for searches. While this application is written in Python, the API is a RESTful Web service compatible with most programming languages. The source code for this sample is available on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/python/Search/BingAutosuggestv7.py)
1818

1919
## Prerequisites
2020

@@ -30,7 +30,7 @@ Use this quickstart to begin making calls to the Bing Autosuggest API and gettin
3030
import http.client, urllib.parse, json
3131
```
3232

33-
2. Create variables for your API host and path, [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and a partial search query. You can use the global endpoint below, or the [custom subdomain](../../../cognitive-services/cognitive-services-custom-subdomains.md) endpoint displayed in the Azure portal for your resource.
33+
2. Create variables for your API host and path, [market code](https://docs.microsoft.com/rest/api/cognitiveservices-bingsearch/bing-autosuggest-api-v7-reference#market-codes), and partial search query. 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.
3434

3535
```python
3636
subscriptionKey = 'enter key here'

0 commit comments

Comments
 (0)