This week I released the JSON REST API Subscriptions plugin for WordPress. The plugin requires the JSON REST API plugin.
The JSON REST API plugin creates endpoints like so
yoursite.com/wp-json/wp/v2/posts
yoursite.com/wp-json/wp/v2/posts/253
yoursite.com/wp-json/wp/v2/pages
yoursite.com/wp-json/wp/v2/pages/987
...
Obviously the /posts endpoint returns all posts and the posts/253 returns the post with ID 253.
The JSON REST API Subscriptions plugin adds webhooks style subscriptions to those endpoints like so:
yoursite.com/wp-json/wp/v2/posts/subscriptions
yoursite.com/wp-json/wp/v2/posts/253/subscriptions
yoursite.com/wp-json/wp/v2/pages/subscriptions
yoursite.com/wp-json/wp/v2/pages/987/subscriptions
By sending an HTTP request to yoursite.com/wp-json/wp/v2/posts/subscriptions like so:
{
"target": "http://notifyurl.com"
"events": ["create", "update", "delete"]
}
http://notifyurl.com would be sent a notification HTTP request every time a post is created, updated, or deleted. All subscription routes, requests, and notifications are explained in detail on Github.
Using this plugin gives websites digesting your content an alternative to parsing feeds.