WP-toolkit rest api
I just found out that WP-toolkit has a rest api.
fantastic... I could really really use it.
I found it by going into WHM -> WP-Toolkit -> Settings- > Open REST API documentation.
in there we see three options:
1. Servers
2. host
3. cpanelOrWhmSecurityToken
I can use this swagger webGUI to make my API calls, and I get the results successfully.
but I cannot for the life of me get this to work outside of WebGUI.... for example if im using Visual Studio Code with REST API extension.
here is what I believe should be the correct way:
first get a Security Token (/0123456789):
to get a security Token, I read in your API doc's I should do this:
GET whostmgrd&user=root
Authorization: whm root:[API_TOKEN]
Calling these api requests, I get a successful response that includes the session_token that looks like this (/0123456789), and some more interesting results... like a SSO url.
ok... so then I should be able to make another API request to the WP-toolkit rest API service using this user_session token ?? correct ??,, something like this:
GET /0123456789/cgi/wpt/index.php/v1/installations?sortBy=title&sortOrder=asc
Accept: application/json
Authorization: Basic [API_TOKEN]
but no matter what I try, I just cannot make this work...
and I have tried almost everything.
I just get Token denied. and the results are just html.... most of the times just the login screen html.
I have also tried to use Authorization: whm root:[API_TOKEN]....
but I also get Token denied.
I have tried creating a session_token with different API version.. but it does not work.
so.... :
what is the correct way of making requests to the WP-toolkit REST API, remotely ?
authenticating and then making the request it self.
-
Hi Baroninn. You have authorised your endpoints at Open WP Toolkit > 'Global Settings' > 'Open REST API documentation' right? 81517 I don't think you would be able to authorise localhost. Have you tried sending the calls from an a open host? 0 -
no no no... The WebGUI works perfectly..,... all you need to do is choose the correct server, fill in the host and then manually type in the SecurityToken. But thats not what im trying to do. im trying to make API calls to the WP-toolkit REST API from external source....... not localhost. 0 -
nobody knows the correct way ? 0 -
It's awesome that you discovered WP-toolkit's REST API! It can be a game-changer, right? However, I understand that you're facing some challenges when trying to use it outside of the WebGUI, like in Visual Studio Code with the REST API extension. 0
Please sign in to leave a comment.
Comments
4 comments