wp-toolkit API endpoint?
How exactly can I access wp-toolkit externally by API? I want to have it install Wordpress on a newly created account/domain.
What is the endpoint and params to achieve this? I have already figured out creating the account/domain part. But how can I access wp-toolkit by API?
A sample request / payload would be highly appreciated
Thanks
-
Hey there! There is no API for WP Toolkit at this time. The closest thing we have would be the command line interface tool, and we have more details about this here:
https://docs.cpanel.net/knowledge-base/cpanel-developed-plugins/wp-toolkit-command-line-interface/
0 -
This one was bothering me too. I finally spent some time figuring it out and have posted an example script here: https://gist.github.com/joelw/8397e8e78a40233226babe8b46ad16b6
The steps are:
- Use the whmapi1 command line program to create a login session for root to access WHM. This will work if you're running the script on the cPanel server as root. If you want to do this remotely, you can also do this via HTTP with an API token. See the previous revision of the gist for how to do this.
- "log in" using the link create_user_session gives you, retrieving the cpsess identifier and a cookie
- Finally, you can access the WP Toolkit API endpoints. My example will perform a full scan of the server, which will find new WordPress installations.
The API documentation can be found inside WHM if you go to WP Toolkit, Settings, Open REST API documentation . OpenAPI definition is at https://example.com:2087/cpsess????/cgi/wpt/index.php/v1/specification/public .
0
Please sign in to leave a comment.
Comments
2 comments