-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaz-bing-cli.sh
More file actions
executable file
·44 lines (25 loc) · 1.41 KB
/
az-bing-cli.sh
File metadata and controls
executable file
·44 lines (25 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
echo ">>> Starting ./az-bing-cli.sh "
set -o errexit
if [[ -z $MY_RG ]]; then
source ../setup.sh # in folder above this.
fi
## Create Cognitive service:
# https://stackoverflow.com/questions/42123633/access-denied-due-to-invalid-subscription-key-face-api
### No need to login ifcan be found:
# az login --allow-no-subscriptions # --use-device-code
#sleep 5 # wait to see https://docs.microsoft.com/en-us/cli/azure/
## A Resource Group does not need to be created for Bing search
# Search API DOC: https://dev.cognitive.microsoft.com/docs/services/f40197291cd14401b93a478716e818bf/operations/56b4447dcf5ff8098cef380d
#echo "https://api.cognitive.microsoft.com/bing/v7.0/search fails with message:"
#echo " The request is not authorized because credentials are missing or invalid. code : 401000"
#exit
# https://docs.microsoft.com/en-us/answers/questions/160048/request-to-bing-search-v7-api-unauthorized.html
# NOTE: Deprecated: GET 'https://api.bing.microsoft.com/v7.0/search?q=Welsch%20Corgis&count=10&offset=0&mkt=en-us&safesearch=Moderate' \
# echo ">>> Bing GET \"$MY_SUBSCRIPTION_ID\" "
curl -X GET 'https://westus.cognitiveservices.azure.com/bing/v7.0/search?q=Welsch%20Corgis&count=10&offset=0&mkt=en-us&safesearch=Moderate' \
-H 'Ocp-Apim-Subscription-Key: $MY_SEARCH_STRING' \
-H 'Ocp-Apim-Subscription-Region: $MY_LOC' \
| json_pp
exit
https://westus.api.cognitive.microsoft.com/