The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

JSON API -> Permission Denied

Discussion in 'cPanel Developers' started by reatum, Mar 17, 2010.

  1. reatum

    reatum Registered

    Joined:
    Mar 17, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Hi

    I'm trying to create custom wrappers for the api calls (don't want to use the xml class).
    Account creation works fine, but account termination and ip change shows up:

    stdClass Object
    (
    [status] => 0
    [statusmsg] => Permission Denied
    )

    Do you have any ideas?
    By the way, I'm using the root account.
     
  2. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Json-api denies permission for removeacct

    Hi Reatum,

    If you're authenticating as root, then their should be no problem. First thing I'd try is to dump the actual URL/query string and make sure that the right HTTP request is being made. It should look something like:
    Code:
    https://192.168.1.1:2087/json-api/removeacct?user=byebye
    
    My second guess is that you're not authenticating as a privileged user, ie root. I know you said you're using root, but I'm just throwing it out there for others that maybe in a similar situation. If you have a reseller account, it's possible that you can create accounts but not have permission to terminate accounts.

    Lastly, I personally haven't been able to reproduce that message for removeacct. You say you're able to make any other call via json-api without failure? It's possible, though unlikely, that you're running into a security issue. That is, your calls have sent up some flags and the server is halting your actions. --just a wild thought

    Check you're requesting URL and see what it is, hopefully it'll be simple fix!
    -Dave

    PS. you can almost always make any query call directly in a browser address bar, you just need to authenticate once ;)
     
  3. reatum

    reatum Registered

    Joined:
    Mar 17, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    My bad. Didn't know that the authentication header has to be set on every request.
    Keep up the good work!

    Radu
     
  4. reatum

    reatum Registered

    Joined:
    Mar 17, 2010
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I've given up building my own custom api implementation, and used the existing one, only to get the same error:

    Array
    (
    [status] => 0
    [statusmsg] => Permission Denied
    )

    Now that's only returned when I call the setsiteip function. Account creation/termination works fine.

    Any ideas?
    Thanks!
     
  5. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    accessed denied for setsiteip

    Hey reatum,

    I don't know why you'd receive that error on setsiteip.

    If you're using the XMLAPI.php client class, set it to debug mode and post the output (in a code block).

    Code:
    $xmlapi-set_debug(1);
    
    $xmlapi->setsiteip('9.3.2.1','username'); //or "'9.3.2.1', null, 'mysite.com'"
    
    output:
    Code:
    URL: https://192.162.1.1:2087/xml-api/setsiteip
    DATA: ip=9.3.2.1&user=someone
    Authentication Header: Authorization: Basic jm9vdApcaGFuZWzx
    
    
    RESPONSE:
     <setsiteip>
      <result>
        <status>1</status>
        <statusmsg></statusmsg>
      </result>
    </setsiteip>
    
    SimpleXML var_dump:
    SimpleXMLElement Object
    (
        [result] => SimpleXMLElement Object
            (
                [status] => 1
                [statusmsg] => SimpleXMLElement Object
                    (
                    )
    
            )
    
    )
    
    
    -Dave

    PS. remember to add your IPs before you attempt to assign them.
     
  6. rawat

    rawat Member

    Joined:
    May 21, 2010
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    0
    How to use XML API with Asp.net

    Hello,

    i m trying XML API for Create Account but facing Authentication Error.Please help example for Create Account with Asp.net.

    I m


    ThanX
     
  7. cPanelDavidN

    cPanelDavidN Integration Developer
    Staff Member

    Joined:
    Dec 17, 2009
    Messages:
    571
    Likes Received:
    1
    Trophy Points:
    18
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page