WHM API 1 - Basic Test failing 403

sisir

Registered
Feb 20, 2018
2
0
1
Bangladesh
cPanel Access Level
Root Administrator
Hello,

I am doing a basic call to whm api 1 by following documentation https://documentation.cpanel.net/display/DD/Guide+to+WHM+API+1

I have created the api token from whm panel. And trying to do a get request via Postman to get an user account statistics.

Code:
GET https://server.xxxxx.com:2087/111111111111111111111111/json-api/accountsummary?api.version=1&user=username
I get 403 in return

Code:
{"cpanelresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}

NOTE: The api token as root access (double checked). Also check in response the apiversion is 2 so I am gussing the documentation is not upgraded and doing the api call I am calling the version 2 of the api?

What I am doing wrong?
 

cPanelTJ

Product Owner
Staff member
Jan 29, 2019
97
50
93
Houston, TX
cPanel Access Level
Root Administrator
Twitter

cPanelTJ

Product Owner
Staff member
Jan 29, 2019
97
50
93
Houston, TX
cPanel Access Level
Root Administrator
Twitter

screwtape

Registered
May 21, 2020
2
0
1
Johannesburg
cPanel Access Level
Reseller Owner
Hi I am experiencing the same issues and im using POSTMAN. I just need clarity on the following. 1. Where exactly in the URL should i be placing the token, is it the part in ur example with "1111111..." 2. Please explain what do you mean by Authorization Header. I dont seem to have that option under Authorization
 

cPanelTJ

Product Owner
Staff member
Jan 29, 2019
97
50
93
Houston, TX
cPanel Access Level
Root Administrator
Twitter
@screwtape

In a general curl request, it should look like:

Code:
curl -H'Authorization: whm root:<INSERT TOKEN HERE>' 'https://<SERVER IP ADDRESS>:2087/json-api/accountsummary?api.version=1&user=<USERNAME>'
I'm not too familiar with POSTMAN.