Contributors: brettkrueger
Donate link: https://patreon.com/kruxlabs/
Tags: json, api, multisite
Requires at least: 5.1
Requires PHP: 7.0
Tested up to: 5.4.1
Stable tag: v1.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
This plugin provides several endpoints for creating, listing, updating, and deleting WordPress multisites. It aims to make headless WordPress multisite environments not only possible, but practical.
You can install this using all the usual methods. The only difference is that this plugin must be network activated.
- Navigate to 'Add New' in the plugins dashboard
- Search for 'multisite rest api'
- Click 'Install Now'
- Network Activate the plugin in the Plugin dashboard
- Navigate to 'Add New' in the plugins dashboard
- Navigate to the 'Upload' area
- Select
multisite-rest-api.zip
from your computer - Click 'Install Now'
- Network Activate the plugin in the Plugin dashboard
- Download
multisite-rest-api.zip
- Extract the
multisite-rest-api
directory to your computer - Upload the
multisite-rest-api
directory to the/wp-content/plugins/
directory - Network Activate the plugin in the Plugin dashboard
Upgrades are pushed through WordPress.org.
- Adding assign function and GET specification for /sites endpoint.
- Create, List, Update, Delete multisites.
All endpoints require authentication from an existing WordPress user. We suggest using JWT through something like simple-jwt-login.
- Endpoint: /wp-json/wp/v2/sites
- Method: GET
- Args: ["blog_id"]
- Examples:
curl -X GET /wp-json/wp/v2/sites -H "Authorization: JWT_TOKEN"
curl -X GET /wp-json/wp/v2/sites/13 -H "Authorization: JWT_TOKEN"
- Endpoint: /wp/v2/create
- Method: POST
- Args: ["domain", "admin_email", "admin_user" (defaults to current user), $options]
- Examples:
curl -X POST /wp-json/wp/v2/sites/create\?domain\=DOMAIN\&admin_email\=EMAIL\&title\=TITLE -H "Authorization: JWT_TOKEN"
- Endpoint: /wp/v2/update
- Method: PUT
- Examples:
curl -X PUT /wp-json/wp/v2/sites/update\?blog_id=13&\domain\=testing13.domain.local\&admin_email\[email protected]\&title\=TESTING_13 -H "Authorization: JWT_TOKEN"
- Endpoint: /wp-json/wp/v2/sites
- Method: DELETE
- Args: ["blog_id"]
- Examples:
curl -X DELETE /wp-json/wp/v2/sites/delete\?blog_id\=13 -H "Authorization: JWT_TOKEN"
curl -X DELETE /wp-json/wp/v2/sites/delete/13 -H "Authorization: JWT_TOKEN"
- Endpoint: /wp-json/wp/v2/assign
- Method: PATCH
- ARGS: ["user_id", "blog_id"] (defaults to current user_id)
- Examples:
curl -X PATCH /wp-json/wp/v2/sites/assign\?blog_id\=13 -H "Authorization: JWT_TOKEN"
curl -X PATCH /wp-json/wp/v2/sites/assign\?user_id=3&\?blog_id\=13 -H "Authorization: JWT_TOKEN"