Skip to content

Instantly share code, notes, and snippets.

@natclark
Created August 20, 2021 06:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save natclark/a9a015c96ba48d91f3191dfa1c29af83 to your computer and use it in GitHub Desktop.
Save natclark/a9a015c96ba48d91f3191dfa1c29af83 to your computer and use it in GitHub Desktop.
Automate URL submission to Bing Webmaster API
#!/bin/bash
var() {
VAR=$(grep $1 $2 | xargs)
IFS="=" read -ra VAR <<< "$VAR"
echo ${VAR[1]}
}
BING_API_KEY=$(var BING_API_KEY .env)
site="https://example.com"
url=$1
curl -X POST "https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlBatch?apikey=$BING_API_KEY" -H "Content-Type: application/json" -H "charset: utf-8" -d '{"siteUrl":"'$site'", "urlList":["'$url'"]}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment