Skip to content

Commit 6c3204b

Browse files
author
dksimpson
committed
Edits
1 parent be7dba8 commit 6c3204b

File tree

4 files changed

+52
-49
lines changed

4 files changed

+52
-49
lines changed

articles/cognitive-services/Bing-Entities-Search/quickstarts/csharp.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,13 @@ Although this application is written in C#, the API is a RESTful Web service com
6969

7070
## Send a request and get the API response
7171

72-
1. Within the class, create a function called `Search()`. Create a new `HttpClient` object, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
72+
1. Within the class, create a function called `Search()`. Within this function, create a new `HttpClient` object, and add your subscription key to the `Ocp-Apim-Subscription-Key` header.
7373

74-
1. Construct the URI for your request by combining the host and path. Then, add your market and URL-encode your query.
75-
2. Await `client.GetAsync()` to get an HTTP response, and then store the JSON response by awaiting `ReadAsStringAsync()`.
76-
3. Format the JSON string with `JsonConvert.DeserializeObject()` and print it to the console.
74+
2. Construct the URI for your request by combining the host and path. Then, add your market and URL-encode your query.
75+
76+
3. Await `client.GetAsync()` to get an HTTP response, and then store the JSON response by awaiting `ReadAsStringAsync()`.
77+
78+
4. Format the JSON string with `JsonConvert.DeserializeObject()` and print it to the console.
7779

7880
```csharp
7981
async static void Search()
@@ -92,7 +94,7 @@ Although this application is written in C#, the API is a RESTful Web service com
9294
}
9395
```
9496

95-
2. In the main method of your application, call the `Search()` function.
97+
5. In the `Main()` method of your application, call the `Search()` function.
9698

9799
```csharp
98100
static void Main(string[] args)

articles/cognitive-services/Bing-Entities-Search/quickstarts/java.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ Although this application is written in Java, the API is a RESTful Web service c
131131

132132
## Call the search function
133133

134-
1. From the main method of your project, call `search()`, and use `prettify()` to format the text.
134+
- From the main method of your project, call `search()`, and use `prettify()` to format the text.
135135

136136
```java
137137
public static void main(String[] args) {

articles/cognitive-services/Bing-Entities-Search/quickstarts/nodejs.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -54,52 +54,53 @@ Although this application is written in JavaScript, the API is a RESTful Web ser
5454

5555
## Handle and parse the response
5656

57-
1. Define a function named `response_handler` that takes an HTTP call, `response`, as a parameter. Within this function, perform the following steps:
57+
1. Define a function named `response_handler()` that takes an HTTP call, `response`, as a parameter.
5858

59-
1. Define a variable to contain the body of the JSON response.
60-
```javascript
61-
let response_handler = function (response) {
62-
let body = '';
63-
};
64-
```
59+
2. Within this function, define a variable to contain the body of the JSON response.
60+
```javascript
61+
let response_handler = function (response) {
62+
let body = '';
63+
};
64+
```
6565

66-
2. Store the body of the response when the `data` flag is called.
67-
```javascript
68-
response.on('data', function (d) {
69-
body += d;
70-
});
71-
```
66+
3. Store the body of the response when the `data` flag is called.
67+
```javascript
68+
response.on('data', function (d) {
69+
body += d;
70+
});
71+
```
7272

73-
3. When an `end` flag is signaled, parse the JSON, and print it.
73+
4. When an `end` flag is signaled, parse the JSON, and print it.
7474

75-
```javascript
76-
response.on ('end', function () {
77-
let json = JSON.stringify(JSON.parse(body), null, ' ');
78-
console.log (json);
79-
});
75+
```javascript
76+
response.on ('end', function () {
77+
let json = JSON.stringify(JSON.parse(body), null, ' ');
78+
console.log (json);
79+
});
8080
```
8181

8282
## Send a request
8383

84-
1. Create a function called `Search` to send a search request. In it, perform the following steps:
84+
1. Create a function called `Search()` to send a search request. In it, perform the following steps:
85+
86+
2. Within this function, create a JSON object containing your request parameters. Use `Get` for the method, and add your host and path information. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
8587

86-
1. Create a JSON object containing your request parameters. Use `Get` for the method, and add your host and path information. Add your subscription key to the `Ocp-Apim-Subscription-Key` header.
87-
2. Use `https.request()` to send the request with the response handler created previously, and your search parameters.
88+
3. Use `https.request()` to send the request with the response handler created previously, and your search parameters.
8889

89-
```javascript
90-
let Search = function () {
91-
let request_params = {
92-
method : 'GET',
93-
hostname : host,
94-
path : path + query,
95-
headers : {
96-
'Ocp-Apim-Subscription-Key' : subscriptionKey,
97-
}
98-
};
90+
```javascript
91+
let Search = function () {
92+
let request_params = {
93+
method : 'GET',
94+
hostname : host,
95+
path : path + query,
96+
headers : {
97+
'Ocp-Apim-Subscription-Key' : subscriptionKey,
98+
}
99+
};
99100

100-
let req = https.request (request_params, response_handler);
101-
req.end ();
102-
}
101+
let req = https.request (request_params, response_handler);
102+
req.end ();
103+
}
103104
```
104105

105106
2. Call the `Search()` function.

articles/cognitive-services/Bing-Entities-Search/quickstarts/python.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,14 @@ Although this application is written in Python, the API is a RESTful Web service
5656

5757
4. Store the response with `getresponse()`, and return `response.read()`.
5858

59-
```python
60-
def get_suggestions ():
61-
headers = {'Ocp-Apim-Subscription-Key': subscriptionKey}
62-
conn = http.client.HTTPSConnection (host)
63-
conn.request ("GET", path + params, None, headers)
64-
response = conn.getresponse ()
65-
return response.read()
66-
```
59+
```python
60+
def get_suggestions ():
61+
headers = {'Ocp-Apim-Subscription-Key': subscriptionKey}
62+
conn = http.client.HTTPSConnection (host)
63+
conn.request ("GET", path + params, None, headers)
64+
response = conn.getresponse ()
65+
return response.read()
66+
```
6767

6868
5. Call `get_suggestions()`, and print the JSON response.
6969

0 commit comments

Comments
 (0)