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.

Need some detailed info on xml-api url calls.

Discussion in 'cPanel Developers' started by DeadManWalking, Apr 13, 2008.

  1. DeadManWalking

    DeadManWalking Active Member

    Joined:
    Dec 9, 2004
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Japan
    I read all the docs in this site, including the .pdf presentation, but couldn't find an answer.

    This example creates a pop email account: nick@domain.tld with password: somepass
    Code:
    /xml-api/cpanel?user=nick&xmlin=<cpanelaction><module>Email</module><func>addpop</func><apiversion>1</apiversion><args>nick</args><args>somepass</args><args>domain.tld</args></cpanelaction>
    But which order I should enter the <args> tags? I mean how API knows "nick" is account name, and "somepass" is a password? If I want to add a "quote" arg like <arg>200</arg>, where should I add it?

    Also above "addpop" function is not listed in here:
    http://www.cpanel.net/plugins/api2/index.html

    Thanks.
     
  2. JamieD

    JamieD Well-Known Member

    Joined:
    Sep 3, 2003
    Messages:
    58
    Likes Received:
    0
    Trophy Points:
    6
    Why not use API2? Your args are then contained in an xml tag e.g.

    <args><name>nick</name><password>somepass</password></args>

    This is what I have been using.
     
  3. DeadManWalking

    DeadManWalking Active Member

    Joined:
    Dec 9, 2004
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Japan
    Never mind, I've just learned how to use

    <?cp ?> tags.

    Awesome :)
     
  4. gopanin

    gopanin Member

    Joined:
    Apr 21, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    <?cp tags

    can some one tell me a bit more about it, i already heard from people that its awesome, but i really don't understand what to do

    i saw this example

    Calling this URL in WebHost Manager: /xml-api/setupreseller?user=bob&makeowner=1

    will produce XML similar to:

    <setupreseller>

    <result status=``1'' statusmsg=``''/>

    </setupreseller>

    how can i use it practically with a script, where can i put my <?cp tags, in an html or an xml
     
  5. gopanin

    gopanin Member

    Joined:
    Apr 21, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    pop create

    /xml-api/cpanel?user=nick&xmlin=<cpanelaction><module>Email</module><func>addpop</func><apiversion>1</apiversion><args>nick</args><args>somepass</args><args>domain.tld</args></cpanelaction>

    how to run that script, i mean whats the complete URL if its needed to run in a browser, or else suggest me a practical script
     
  6. DeadManWalking

    DeadManWalking Active Member

    Joined:
    Dec 9, 2004
    Messages:
    42
    Likes Received:
    0
    Trophy Points:
    0
    Location:
    Japan
    gopanin, do you know any scripting language? Like PHP, ASP, Perl, Python etc.?
     
  7. gopanin

    gopanin Member

    Joined:
    Apr 21, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Yes i do, i can handle PHP ASP and PERL, i prefer PHP though
     
  8. gopanin

    gopanin Member

    Joined:
    Apr 21, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    XML is not usual for me and i never used cpanel XML API thats my issue, i just needed a start...
    :)
     
  9. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    the complete URL would be https://Server:2087/xml-api... or http://Server:2086/xml-api... where Server is either the IP or hostname of the server or a domain hosted on that server which has reseller privileges.

    There's some PHP sample code around the forum showing how to do this in PHP using Curl as well as other PHP functions.

    API1 and API2 calls control functionality of the cPanel interface, not the WHM interface. Keep in mind the X3 theme is almost entirely built on API2, so if you need an API and can't find documentation for it (official documentation is still in progress), don't hesitate to look at the source code of the X3 theme in /usr/local/cpanel/base/frontend/x3 to find the API call you need.
     
  10. gopanin

    gopanin Member

    Joined:
    Apr 21, 2008
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    david,

    i searched a lot but failed to find a script, please help me with one php script or a link to a script...
     
  11. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Try doing a search on these forums for XML API PHP. There are many relevant results.

    A search on phpClasses.org for cPanel also yielded useful results.
     
  12. hellomoto

    hellomoto Registered

    Joined:
    May 9, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    Change Password or quota

    Hi to everyone,
    I have a little problem ,can you help me
    Does anyone knows how to change password and qouta with xml api? what are the functions?
     
  13. hellomoto

    hellomoto Registered

    Joined:
    May 9, 2008
    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    By the way, I found how to set quota, when you create new email account..the api is:
    /xml-api/cpanel?user=nick&xmlin=<cpanelaction><module>Email</module><func>addpop</func><apiversion>1</apiversion><args>$user</args><args>$password</args><args>$quota</args><args>$domain</args></cpanelaction>
     
  14. cPanelDavidG

    cPanelDavidG Technical Product Specialist

    Joined:
    Nov 29, 2006
    Messages:
    11,279
    Likes Received:
    8
    Trophy Points:
    38
    Location:
    Houston, TX
    cPanel Access Level:
    Root Administrator
    Changing password:

    API 1 function:

    Code:
    <cpanel Email="passwdpop($FORM{'email'},$FORM{'password'},$FORM{'quota'},$FORM{'domain'})
    
    Where the email address is of format email@domain

    Changing Quota:

    API 1 function:

    Code:
     <cpanel Email="editquota($FORM{'email'},$FORM{'domain'},$FORM{'quota'})">
    
     
    #14 cPanelDavidG, May 9, 2008
    Last edited: May 9, 2008
Loading...

Share This Page