The WPCloudDeploy REST API is an ongoing project that will eventually consist of several hundred end points.
The first few endpoints will be production-ready starting with WPCD Version 4.14.0.
The REST API uses the standard http verbs:
The API is protected by basic HTTP authentication.
You can create HTTP Authentication credentials using the WordPress APPLICATION PASSWORDS function. The RESTAPI will only allow users with the the ADMIN or WPCDAdmin roles. All other users will get an authentication error.
Documentation on all endpoints is located here: WPCD REST API Endpoints
The current endpoints allow you to create new servers and sites, delete those servers and sites, list servers and sites, toggle SSL and clone and change domain for a site.
The API is disabled by default. You need to explicitly turn it on before you can use it.
The WPCloudDeploy REST API is available to everyone including Core subscribers and Github users. However, support is only available to All Access subscribers and Lifetime license holders.
Technical support is limited to bug reports only.
Because the REST API is, by definition, a tool to be used by developers, we are unable to offer free support beyond handling bug reports or suggestions for improving documentation. Otherwise we’d be spending an enormous amount of time just debugging customized code for free.
However, a Developer Support contract is available for purchase that will allow for more in-depth consultative support. Just contact us and we’ll create one for you.
Below are some screen shots from a no-code application (i.e.: an application that is not WordPress) that uses the REST API. This is a sample application that we have created to stress-test the endpoints.
curl --request POST \ https://yourwpcddomain.com/wp-json/wpcd/v1/servers \ --user "wpcdadmin:wpcdadminpass" \ --header 'Content-Type: multipart/form-data' \ -F "name=\"test099\";type=application/json" \ -F "provider=\"digital-ocean\";type=application/json" \ -F "region=\"nyc3\";type=application/json" \ -F "size=\"s-1vcpu-1gb\";type=application/json" \ -F "author_email=\"[email protected]\";type=application/json"
Notice that the data is being sent as multipart form but that all the fields are formatted as json.
curl --request DELETE https://yourwpcddomain.com/wp-json/wpcd/v1/servers/116 \ --user "wpcdadmin:wpcdadminpass"
This deletes server with post id 116.
curl https://yourwpcddomain.com/wp-json/wpcd/v1/tasks/117 \ --user "wpcdadmin:wpcdadminpass"
This will get the status of task with ID 117. This id was given to us from the CREATE A SERVER request.