Skip to content

Commit b2cc620

Browse files
authored
Merge pull request #114216 from dksimpson/DKS-US1712683-bing-custom-search
Refresh Bing Custom Search API quickstarts
2 parents 635339e + 57995c2 commit b2cc620

File tree

5 files changed

+60
-54
lines changed

5 files changed

+60
-54
lines changed

articles/cognitive-services/Bing-Custom-Search/call-endpoint-csharp.md

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,37 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-custom-search
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/08/2020
1313
ms.author: aahi
1414
---
1515

1616
# Quickstart: Call your Bing Custom Search endpoint using C#
1717

18-
Use this quickstart to begin requesting search results from your Bing Custom Search instance. While this application is written in C#, the Bing Custom Search API is a RESTful web service compatible with most programming languages. The source code for this sample can be found on [GitHub](https://github.com/Azure-Samples/cognitive-services-REST-api-samples/blob/master/dotnet/Search/BingCustomSearchv7.cs).
18+
Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in C#, the Bing Custom Search 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/BingCustomSearchv7.cs).
1919

2020
## Prerequisites
2121

22-
- A Bing Custom Search instance. See [Quickstart: Create your first Bing Custom Search instance](quick-start.md) for more information.
23-
- Microsoft [.NET Core](https://www.microsoft.com/net/download/core)
24-
- Any edition of [Visual Studio 2019 or later](https://www.visualstudio.com/downloads/)
25-
- If you are using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
26-
- The [Bing Custom Search](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.CustomSearch/1.2.0) NuGet package.
27-
- From **Solution Explorer** in Visual Studio, right-click your project and select **Manage NuGet Packages** from the menu. Install the `Microsoft.Azure.CognitiveServices.Search.CustomSearch` package. Installing the NuGet Custom Search package also installs the following assemblies:
28-
- Microsoft.Rest.ClientRuntime
29-
- Microsoft.Rest.ClientRuntime.Azure
30-
- Newtonsoft.Json
22+
- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).
23+
- [Microsoft .NET Core](https://www.microsoft.com/net/download/core).
24+
- Any edition of [Visual Studio 2019 or later](https://www.visualstudio.com/downloads/).
25+
- If you're using Linux/MacOS, this application can be run using [Mono](https://www.mono-project.com/).
26+
- The [Bing Custom Search](https://www.nuget.org/packages/Microsoft.Azure.CognitiveServices.Search.CustomSearch/2.0.0) NuGet package.
27+
28+
To install this package in Visual Studio:
29+
1. Right-click your project in **Solution Explorer**, and then select **Manage NuGet Packages**.
30+
2. Search for and select *Microsoft.Azure.CognitiveServices.Search.CustomSearch*, and then install the package.
31+
32+
When you install the Bing Custom Search NuGet package, Visual Studio also installs the following packages:
33+
- **Microsoft.Rest.ClientRuntime**
34+
- **Microsoft.Rest.ClientRuntime.Azure**
35+
- **Newtonsoft.Json**
36+
3137

3238
[!INCLUDE [cognitive-services-bing-custom-search-prerequisites](../../../includes/cognitive-services-bing-custom-search-signup-requirements.md)]
3339

3440
## Create and initialize the application
3541

36-
1. Create a new C# console application in Visual Studio. Then add the following packages to your project.
42+
1. Create a new C# console application in Visual Studio. Then, add the following packages to your project:
3743

3844
```csharp
3945
using System;
@@ -42,7 +48,7 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
4248
using Newtonsoft.Json;
4349
```
4450

45-
2. Create the following classes to store the search results returned by the Bing Custom Search API.
51+
2. Create the following classes to store the search results returned by the Bing Custom Search API:
4652

4753
```csharp
4854
public class BingCustomSearchResponse {
@@ -66,15 +72,15 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
6672
}
6773
```
6874

69-
3. In the main method of your project, create variables for your Bing Custom Search API subscription key, your search instance's Custom Configuration ID, and a search term.
75+
3. In the main method of your project, create the following variables for your Bing Custom Search API subscription key, search instance's custom configuration ID, and search term:
7076

7177
```csharp
7278
var subscriptionKey = "YOUR-SUBSCRIPTION-KEY";
7379
var customConfigId = "YOUR-CUSTOM-CONFIG-ID";
7480
var searchTerm = args.Length > 0 ? args[0]:"microsoft";
7581
```
7682

77-
4. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's Custom Configuration ID to `customconfig=`. separate the parameters with a `&` character. `url` 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.
83+
4. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's custom configuration ID to the `customconfig=` parameter. Separate the parameters with an ampersand (`&`). For the `url` variable value, 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.
7884

7985
```csharp
8086
var url = "https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?" +
@@ -98,9 +104,9 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
98104
var responseContent = httpResponseMessage.Content.ReadAsStringAsync().Result;
99105
BingCustomSearchResponse response = JsonConvert.DeserializeObject<BingCustomSearchResponse>(responseContent);
100106
```
101-
## Process and view the results
107+
## Process and view the results
102108

103-
3. Iterate over the response object to display information about each search result, including its name, url, and the date the webpage was last crawled.
109+
- Iterate over the response object to display information about each search result, including its name, url, and the date the webpage was last crawled.
104110

105111
```csharp
106112
for(int i = 0; i < response.webPages.value.Length; i++) {

articles/cognitive-services/Bing-Custom-Search/call-endpoint-java.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,27 @@ manager: nitinme
99
ms.service: cognitive-services
1010
ms.subservice: bing-custom-search
1111
ms.topic: quickstart
12-
ms.date: 03/24/2020
12+
ms.date: 05/08/2020
1313
ms.author: aahi
1414
---
1515

1616
# Quickstart: Call your Bing Custom Search endpoint using Java
1717

18-
Use this quickstart to begin requesting search results from your Bing Custom Search instance. While this application is written in Java, the Bing Custom Search 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/BingCustomSearchv7.java).
18+
Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in Java, the Bing Custom Search 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/BingCustomSearchv7.java).
1919

2020
## Prerequisites
2121

22-
- A Bing Custom Search instance. See [Quickstart: Create your first Bing Custom Search instance](quick-start.md) for more information.
22+
- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).
2323

24-
- The latest [Java Development Kit](https://www.oracle.com/technetwork/java/javase/downloads/index.html)
24+
- The latest [Java Development Kit](https://www.oracle.com/technetwork/java/javase/downloads/index.html).
2525

26-
- The [Gson library](https://github.com/google/gson)
26+
- The [Gson library](https://github.com/google/gson).
2727

2828
[!INCLUDE [cognitive-services-bing-custom-search-prerequisites](../../../includes/cognitive-services-bing-custom-search-signup-requirements.md)]
2929

3030
## Create and initialize the application
3131

32-
1. Create a new Java project in your favorite IDE or editor, and import the following libraries.
32+
1. Create a new Java project in your favorite IDE or editor, and import the following libraries:
3333

3434
```java
3535
import java.io.InputStream;
@@ -46,7 +46,7 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
4646
import com.google.gson.JsonParser;
4747
```
4848

49-
2. Create a class named `CustomSrchJava`, and create variables for your subscription key, custom search endpoint, and your search instance's Custom Configuration ID. 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.
49+
2. Create a class named `CustomSrchJava`, and then create variables for your subscription key, custom search endpoint, and search instance's custom configuration ID. 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.
5050
```java
5151
public class CustomSrchJava {
5252
static String host = "https://api.cognitive.microsoft.com";
@@ -84,7 +84,7 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
8484

8585
## Send and receive a search request
8686

87-
1. Create a function named `SearchWeb()` that sends a request and returns a `SearchResults` object. Create the request url by combining your Custom Configuration ID, query, and endpoint information. Add your Subscription key to the `Ocp-Apim-Subscription-Key` header.
87+
1. Create a function named `SearchWeb()` that sends a request and returns a `SearchResults` object. Create the request url by combining your custom configuration ID, query, and endpoint information. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
8888

8989
```java
9090
public class CustomSrchJava {
@@ -116,7 +116,7 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
116116
}
117117
```
118118

119-
3. In the main method of your application, call `SearchWeb()` with your search term,
119+
3. Print the JSON response.
120120

121121
```java
122122
System.out.println("\nJSON Response:\n");

articles/cognitive-services/Bing-Custom-Search/call-endpoint-nodejs.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
11
---
22
title: "Quickstart: Call your Bing Custom Search endpoint using Node.js | Microsoft Docs"
33
titleSuffix: Azure Cognitive Services
4-
description: Use this quickstart to begin requesting search results from your Bing Custom Search instance using Node.js
4+
description: Use this quickstart to begin requesting search results from your Bing Custom Search instance using Node.js.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

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

1616
# Quickstart: Call your Bing Custom Search endpoint using Node.js
1717

18-
Use this quickstart to begin requesting search results from your Bing Custom Search instance. While this application is written in JavaScript, the Bing Custom Search 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/BingCustomSearchv7.js).
18+
Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in JavaScript, the Bing Custom Search 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/BingCustomSearchv7.js).
1919

2020
## Prerequisites
2121

22-
- A Bing Custom Search instance. See [Quickstart: Create your first Bing Custom Search instance](quick-start.md) for more information.
22+
- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).
2323

24-
- [Node.js](https://www.nodejs.org/)
24+
- [The Node.js JavaScript runtime](https://www.nodejs.org/).
2525

26-
- The [JavaScript Request Library](https://github.com/request/request)
26+
- The [JavaScript request library](https://github.com/request/request).
2727

2828
[!INCLUDE [cognitive-services-bing-custom-search-prerequisites](../../../includes/cognitive-services-bing-custom-search-signup-requirements.md)]
2929

3030
## Create and initialize the application
3131

32-
1. Create a new JavaScript file in your favorite IDE or editor, and add a `require()` statement for the requests library. Create variables for your subscription key, Custom Configuration ID, and a search term.
32+
- Create a new JavaScript file in your favorite IDE or editor, and add a `require()` statement for the requests library. Create variables for your subscription key, custom configuration ID, and search term.
3333

3434
```javascript
3535
var request = require("request");
@@ -41,7 +41,7 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
4141

4242
## Send and receive a search request
4343

44-
1. Create a variable to store the information being sent in your request. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's Custom Configuration ID to `customconfig=`. separate the parameters with a `&` character. 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.
44+
1. Create a variable to store the information being sent in your request. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's custom configuration ID to the `customconfig=` parameter. Separate the parameters with an ampersand (`&`). 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.
4545
4646
```javascript
4747
var info = {
@@ -54,7 +54,7 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
5454
}
5555
```
5656

57-
1. Use the JavaScript Request Library to send a search request to your Bing Custom Search instance and print out information about the results, including its name, url, and the date the webpage was last crawled.
57+
1. Use the JavaScript request library to send a search request to your Bing Custom Search instance and print information about the results, including its name, url, and the date the webpage was last crawled.
5858

5959
```javascript
6060
request(info, function(error, response, body){

articles/cognitive-services/Bing-Custom-Search/call-endpoint-python.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,33 @@
11
---
22
title: "Quickstart: Call your Bing Custom Search endpoint using Python | Microsoft Docs"
33
titleSuffix: Azure Cognitive Services
4-
description: Use this quickstart to begin requesting search results from your Bing Custom Search instance using Python
4+
description: Use this quickstart to begin requesting search results from your Bing Custom Search instance using Python.
55
services: cognitive-services
66
author: aahill
77
manager: nitinme
88

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

1616
# Quickstart: Call your Bing Custom Search endpoint using Python
1717

18-
Use this quickstart to begin requesting search results from your Bing Custom Search instance. While this application is written in Python, the Bing Custom Search 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/BingCustomSearchv7.py).
18+
Use this quickstart to learn how to request search results from your Bing Custom Search instance. Although this application is written in Python, the Bing Custom Search 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/BingCustomSearchv7.py).
1919

2020
## Prerequisites
2121

22-
- A Bing Custom Search instance. See [Quickstart: Create your first Bing Custom Search instance](quick-start.md) for more information.
23-
- [Python](https://www.python.org/) 2.x or 3.x
22+
- A Bing Custom Search instance. For more information, see [Quickstart: Create your first Bing Custom Search instance](quick-start.md).
23+
- [Python](https://www.python.org/) 2.x or 3.x.
2424

2525
[!INCLUDE [cognitive-services-bing-custom-search-prerequisites](../../../includes/cognitive-services-bing-custom-search-signup-requirements.md)]
2626

2727

2828
## Create and initialize the application
2929

30-
1. Create a new Python file in your favorite IDE or editor, and add the following import statements. Create variables for your subscription key, Custom Configuration ID, and a search term.
30+
- Create a new Python file in your favorite IDE or editor, and add the following import statements. Create variables for your subscription key, custom configuration ID, and search term.
3131

3232
```python
3333
import json
@@ -40,13 +40,13 @@ Use this quickstart to begin requesting search results from your Bing Custom Sea
4040

4141
## Send and receive a search request
4242

43-
1. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's Custom Configuration ID to `customconfig=`. separate the parameters with a `&` character. 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.
43+
1. Construct the request URL by appending your search term to the `q=` query parameter, and your search instance's custom configuration ID to the `customconfig=` parameter. Separate the parameters with an ampersand (`&`). 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.
4444

4545
```python
4646
url = 'https://api.cognitive.microsoft.com/bingcustomsearch/v7.0/search?' + 'q=' + searchTerm + '&' + 'customconfig=' + customConfigId
4747
```
4848

49-
2. Send the request to your Bing Custom Search instance, and print out the returned search results.
49+
2. Send the request to your Bing Custom Search instance, and print the returned search results.
5050

5151
```python
5252
r = requests.get(url, headers={'Ocp-Apim-Subscription-Key': subscriptionKey})

0 commit comments

Comments
 (0)