Results 1 to 7 of 7

Thread: JSON API -> Permission Denied

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Default JSON API -> Permission Denied

    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. #2
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default 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
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Default

    My bad. Didn't know that the authentication header has to be set on every request.
    Keep up the good work!

    Radu

  4. #4
    Registered User
    Join Date
    Mar 2010
    Posts
    3

    Default

    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. #5
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default 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.
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

  6. #6
    Registered User
    Join Date
    May 2010
    Posts
    7

    Default 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. #7
    Integration Developer cPanelDavidN's Avatar
    Join Date
    Dec 2009
    Location
    Houston, TX
    Posts
    570

    Default

    Rawat,

    You've created your own thread about using ASP, hopefully someone can help you there.
    http://forums.cpanel.net/f42/how-use...et-156873.html
    David Neimeyer
    Integration Developer

    sdk.cpanel.net
    APIs: XML-API API1 & API2
    Check Out: Developer Downloads Integration Blog
    Need Support? Support Ticket Developer Forum Feature Requests

Similar Threads

  1. is XML/JSON-API available only to WHM accounts?
    By eschminke in forum cPanel Developers
    Replies: 6
    Last Post: 12-02-2011, 03:35 PM
  2. Create backup through json-api?
    By MACscr in forum cPanel Developers
    Replies: 5
    Last Post: 06-05-2011, 10:31 PM
  3. JSON API - Empty Pages ~50% Of The Time
    By azoundria in forum cPanel Developers
    Replies: 5
    Last Post: 05-26-2011, 11:40 AM
  4. Debugging JSON API Results
    By mikelegg in forum cPanel Developers
    Replies: 8
    Last Post: 12-22-2010, 08:47 PM
  5. XML or JSON API?
    By Azavia in forum cPanel Developers
    Replies: 3
    Last Post: 05-21-2010, 12:16 PM