Using the WordPress REST API, you can easily add or update mapped domains in Domain Mapping System.
Domain Mapping System takes advantage of the WordPress REST API to allow adding and deleting of domain mappings.
When Domain Mapping System is installed, by default, the REST API URL is available on your site at this kind of URL:
Be sure to replace
your-domainwith your primary domain name configured on your WordPress site. This can be founder under the Settings > General tab in the WP-Admin Menu.
The API requires a Token Request for valid authentication. Then, you can add/update mappings as desired.
Authentication to the REST API is facilitated via JSON Web Token (JWT).
First, you must request a token by logging in using the below endpoint and valid WordPress admin credentials.
When requesting the token by logging in, the new JWT will be generated for you and passed in response to the request.
The token will later be required to authorize all calls to the API using the Bearer Token authentication method.
The token is tied to the admin user account. If the admin user account is ever deleted, the token will no longer work.
This request does not support bulk changes. You can add/update only one object per request. If the website is using the free version of the plugin, then you will not be able to add multiple values per mapping or set up a primary value. This means you cannot set up Microsites (or a Microsite homepage), which are paid features.