Skip to main content

Getting account quota via XMLAPI

Comments

3 comments

  • cPanelMichael
    When running, I get a URL of "http://:2082/json-api/get_pop_quota", and that produces a 404 error. Dropping the url manually into my browser gets me {"cpanelresult":{"apiversion":"2","error":"Access denied","data":{"reason":"Access denied","result":"0"},"type":"text"}}

    Hello, It looks like you are missing the session number in the URL. For instance, here's out the URL would look when using the UAPI function in a browser:
    https://hostname.example.com:2083/cpsess##########/execute/Email/get_pop_quota?email=user&domain=example.com&as_bytes=1
    Information on API authentication is available at: Guide to API Authentication - Software Development Kit - cPanel Documentation Thank you.
    0
  • greenbutterfly
    Thanks for the reply, but I'm confused, because I've already got this code which I thought would handle that authentication: $cpanel = new xmlapi("my_login_user_for_cPanel", "my_password", "my_domain"); $cpanel->set_port(2082); $cpanel->set_http_client('curl'); $cpanel->set_output('json'); $cpanel->set_user('my_login_user_for_cPanel'); $cpanel->set_password("my_password"); $cpanel->set_host('my_domain'); I ended up having to put in the user, password and domain twice... I'm assuming because the setting of some of the other bits resets something. Right now, I'm using port 2082 as I'm still organising SSL certification... once done I'll switch it to 2083. From reading through the info, I'm guessing it's not enough, though. I need to separately tell it to log in via a call to the API, is that correct?
    0
  • cPanelMichael
    Thanks for the reply, but I'm confused, because I've already got this code which I thought would handle that authentication: $cpanel = new xmlapi("my_login_user_for_cPanel", "my_password", "my_domain"); $cpanel->set_port(2082); $cpanel->set_http_client('curl'); $cpanel->set_output('json'); $cpanel->set_user('my_login_user_for_cPanel'); $cpanel->set_password("my_password"); $cpanel->set_host('my_domain');

    Hello, You can try using the PHP example for the single sign on functionality documented at: Guide to API Authentication - Single Sign On - Software Development Kit - cPanel Documentation Let us know if that helps. Thank you.
    0

Please sign in to leave a comment.