npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ping_bing

v1.0.0

Published

Node Module to Use the Bing Adaptive URL Submission API

Downloads

18

Readme

ping_bing

A node module to use the Bing Adaptive URL Submission API

This is an unofficial Node module to interface with the Bing Adaptive (Passive) URL Submission API.

There is a single method available and it will work for either a single URL submission or a batch of URLs.

** Bing Limits your daily URL submission to 10,000 URLs, which for most is more than adequate. I have some links below to help you get started with the API and registering your site with the Bing Webmaster Tools.

You will need an API key, again a link below, to use this API. You can only submit URLs for a site you have registered and verified in the Bing WebMaster tools. So no, you cannot submit URLs for sites you do not own.

You should only submit actual content URLs, not your sitemap, rss feed, robots.text or site dependency assets like CSS and JavaScript files.

URL must also comply with the Bing Content Guidelines, which are pretty simple. Make good content people like and don't use Flash and you should comply 😎

Setup

OK, if you know anything about node just skip ahead to the actual code. If you are new to node and npm this will be a quick run through that every node module seems ablidged to include:

Installation

npm install --save ping_bing

Single URL Example

This will submit a single URL.


const pingBing = require( "ping_bing" ),
    apiKey = "[Your API Key Here]",
    siteUrl = "[Your Bing Verified Site URL (domain)]";


const singleURL = {
    apiKey: apiKey,
    siteUrl: siteUrl,
    url: "[url to submit]"
};

pingBing.pingBing( singleURL )
    .then( body => {
        console.log( "success: ", body );
    } )
    .catch( err => {
        console.log( "error: ", err );
    } );

This will submit a batch or array of URLs.


const pingBing = require( "ping_bing" ),
    apiKey = "[Your API Key Here]",
    siteUrl = "[Your Bing Verified Site URL (domain)]";

const batchURLs = {
    apiKey: apiKey,
    siteUrl: siteUrl,
    urlList: [ "[url to submit]", "[url to submit]", "[url to submit]" ]
};

pingBing.pingBing( batchURLs )
    .then( body => {
        console.log( "success: ", body );
    } )
    .catch( err => {
        console.log( "error: ", err );
    } );

You can include this module in your AWS Lambdas, Azure & Google functions to create a nice serverless workflow.

For now the only response the API provides for a successful submission is a JSON object with a 'd' property set to null. If and when they update this I will probably add more response handling to the module.

Bing URL Submission Resources

The Bing Passive/Adaptive URL Submission API

Bing Webmaster Blog Announcement

How Batch Submission Works

Get Bing Webmaster API Key