Accessing Bing Webmaster Tools API using cURL

Thank you webmasters for effectively using Adaptive URL solution to notify bingbot about your website’s most fresh and relevant content. But, did you know you don’t have to use the Bing webmaster tools portal to submit URLs?

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
}}
If the URL submission is successful you will receive an http 200 response. This ensures that your pages will be discovered for indexing and if Bing webmaster guidelines are met then the pages will be crawled and indexed in real time.
So, integrate the APIs today to get your content indexed real time by Bing. Please reach out to Bing webmaster tools support if you face any issues. 

Thanks,
Bing Webmaster Tools team
 

Source: Bing Blog Feed

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.