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.

API only account

Discussion in 'cPanel Developers' started by lmaitland, Aug 30, 2013.

  1. lmaitland

    lmaitland Member

    Joined:
    Aug 17, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello,

    I have a question in relation to my cpanel WHM server.
    Basically i was going to integrate a few of the API functions into my website.
    I have a few questions in relation to this:

    1. I'm guessing i will have to use the XML-API functions ( as my site will be separate from cpanel but on the same server)
    2. Can i make an API only user account ( i have ssh'd into the server and made an account called api with a set password. How can i add access for this account to the api? )

    Preferable id like to avoid doing anything with the root password so would rather keep it to a separate account.

    Thanks,
    Lewis
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,854
    Likes Received:
    675
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Could you elaborate on the purpose of having an account for API purposes only? Typically, API functions occurring for an individual account must occur with authentication as that account. You need to be logged in with the proper permissions in order to call a function. See our document about Authenticating API Function Calls for more information about authenticating APIs from within a script. Note the following document may also be useful:

    cPanel XML and JSON APIs — cpanel

    Thank you.
     
  3. lmaitland

    lmaitland Member

    Joined:
    Aug 17, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Thank you for your response :)

    The only reason for an API only account would be to isolate it from my root account so i dont have to put root passwords etc in my php files.

    Is this possible or is the root details the only way.

    Thank you,
    Lewis
     
  4. lmaitland

    lmaitland Member

    Joined:
    Aug 17, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Ok what ive done was just create a reseller hosting account on my server and im using that to do all the api calls.

    I was going to use the function displaynews , and getpkginfo on my website to show the current news and information about my packages to people who are viewing the site. This means if i make a change to a package it will change it on the site.

    Does anyone know if this is viable in terms of speed ( how costly is it to make lots of frequent api calls )

    Thanks
     
  5. hgrg

    hgrg Well-Known Member

    Joined:
    Oct 4, 2010
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    6
    cPanel Access Level:
    Root Administrator
    I'd do this:
    dont query the api every time a page is loaded coz thats just crazy! Generate a status file(in json format for example < easy to parse with js on the client side..) instead and update it with a cronjob every X minutes/hours and you can load that file with ajax :)
     
Loading...

Share This Page