Name: Mercator-REST-API
Owner: Human Made
Description: REST API for working with domain mappings
Created: 2016-09-23 16:48:16.0
Updated: 2016-11-30 20:08:12.0
Pushed: 2016-11-23 21:22:50.0
Homepage: null
Size: 28
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
REST API for working with domain mappings.
Requires WordPress 4.5+ or the WP REST API plugin
You need to include and instantiate the controller:
action( 'rest_api_init', function() {
include 'class-rest-api.php';
$api = new Mercator\REST_API;
$api->register_routes();
The controller adds two API routes:
json/mercator/v1/mappings // accepts GET, POST
json/mercator/v1/mappings/:id // accepts PUT, PATCH, DELETE
You can additionally specify a blog ID by passing in a GET
parameter:
json/mercator/v1/mappings?blog=1
Mappings are very simple. The example JSON object for a mapping is as follows:
"id": 1 // integer
"domain": "example.com", // string
"active": true // boolean
When creating a mapping using POST
you only need to send the domain
and active
values.