Created
August 20, 2021 06:25
-
-
Save natclark/a9a015c96ba48d91f3191dfa1c29af83 to your computer and use it in GitHub Desktop.
Automate URL submission to Bing Webmaster API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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