WordPress Plugins

JSON REST API Subscriptions Plugin

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.

Standard

One thought on “JSON REST API Subscriptions Plugin

  1. James says:

    Hi Taylor – I’m trying to find a way to send create, update, delete requests to Firebase. Firebase has a simple REST API to create, update and delete nodes (it’s a JSON datastore). It feels like this plug in is really close to being able to achieve what I want and I was wondering if you’ve done any work, or seen any projects, that post JSON to an API endpoint based on WP create, update, delete actions.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s