Accessing Bing Webmaster Tools API using cURL
Bing webmaster tools exposes programmatic access to its APIs for webmasters to integrate their workflows. Here is an example using the popular command line utility cURL that shows how easy it is to integrate the Submit URL single and Submit URL batch API end point. You can use Get url submission quota API to check remaining daily quota for your account.
Bing API can be integrated and called by all modern languages (C#, Python, PHP…), cURL allows to prototype and test the API in minutes and also build complete solution with minimal effort. cURL is considered as one of the most versatile tools for command-line API calls and is supported by all major Linux shells – simply run the below commands in a terminal window. If you’re a Windows user, you can install and use cURL from within Git Bash. If you are a Mac user, you can install cURL using a package manager such as Homebrew.
When you try the examples below, be sure to replace API_KEY with your API key string obtained from Bing webmaster tools > Webmaster API > Generate. Refer easy set-up guide for Bing’s Adaptive URL submission API for more details.
Submitting new URLs – Single
curl -X POST "https://ssl.bing.com/webmaster/api.svc/json/SubmitUrl?apikey=API_KEY" -H "Content-Type: application/json" -H "charset: utf-8" -d '{"siteUrl":"https://www.example.com", "url": "https://www.example.com/about"}' Response: {"d": null}
Submitting new URLs – Batch
curl -X POST “https://ssl.bing.com/webmaster/api.svc/json/SubmitUrlBatch?apikey=API_KEY” -H “Content-Type: application/json” -H “charset: utf-8” -d ‘{“siteUrl”:”https://www.example.com”, “urlList”:[“https://www.example.com/about”, “https://www.example.com/projects”]}’ Response: {“d”:null}
Check remaining API Quota
curl “https://ssl.bing.com/webmaster/api.svc/json/GetUrlSubmissionQuota?siteUrl=https://www.example.com&apikey=API_KEY” Response: { “d”: {“__type”: “UrlSubmissionQuota:#Microsoft.Bing.Webmaster.Api”, “DailyQuota”: 973, “MonthlyQuota”: 10973 }}
Thanks,
Bing Webmaster Tools team
Source: Bing Blog Feed