Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 8 of 8
  1. #1
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    cPanel/Enkompass Access Level

    Reseller Owner

    Default How do I use the cPanel/WHM API?

    Hello, I would like to use the cPanel/WHM API.

    I would like a script which makes a database, then makes the user and adds the user with all permissions.

    Thanks a lot, it would be easier if I could do this through my WHM hash.

  2. #2
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: How do I use the cPanel/WHM API?

    Have you had a peek at the cPanel Developers Blog? That would probably be a great place to get started. Also this very forum section you've posted to has lots of threads you might find some use from.



    HTH!

  3. #3
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    cPanel/Enkompass Access Level

    Reseller Owner

    Default Re: How do I use the cPanel/WHM API?

    Quote Originally Posted by Infopro View Post
    Have you had a peek at the cPanel Developers Blog? That would probably be a great place to get started. Also this very forum section you've posted to has lots of threads you might find some use from.



    HTH!
    Okay, thanks, but I have checked that, and I just can not find what I am looking for.
    It would be easier with either a pre built php script for what I want or a class which allows these to become easy functions.

  4. #4
    cPanel Product Evangelist Infopro's Avatar
    Join Date
    May 2003
    Location
    Pennsylvania
    Posts
    7,894
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: How do I use the cPanel/WHM API?

    Search this developer forum specifically for the words create database I think what you seek can be found in those results.

  5. #5
    cPanel Staff
    Join Date
    Apr 2011
    Location
    Houston, TX
    Posts
    26
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: How do I use the cPanel/WHM API?

    We do have a PHP class specifically for performing functions through the XML-API, called the XML-API PHP Class.

    There are specific examples of usage in the Examples directory which can be manipulated for different functions. Also, there are quite a few threads here on the forum explaining how to change them.

    The scripts in the Examples directory and also here in the forums are probably the closest you'll come to finding a pre-built script, aside from someone building you one.
    Last edited by cPanelBlaine; 02-10-2012 at 12:34 PM. Reason: typo and grammer (should have proofread)

  6. #6
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    cPanel/Enkompass Access Level

    Reseller Owner

    Default Re: How do I use the cPanel/WHM API?

    Okay, thanks guys.
    Okay, I got some script which works, however it seems to create the database and user.
    Here is what sort of code is going in:
    print_r ($xmlapi->api1_query("acctest", "Mysql", "adduserdb", array("acctest_db", "acctest_user", 'all')));
    Outputs:
    Array ( [module] => Mysql [func] => adduserdb [type] => event [source] => internal [apiversion] => 1 [data] => Array ( [result] => You do not have access to that database (acctest_user)! ) [event] => Array ( [result] => 1 ) [postevent] => Array ( [result] => 1 ) [preevent] => Array ( [result] => 1 ) )
    When I try to do a query using mysql_query:
    No database selected
    Thanks.
    Last edited by Valdamoon; 02-10-2012 at 01:11 PM.

  7. #7
    cPanel Staff
    Join Date
    Apr 2011
    Location
    Houston, TX
    Posts
    26
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: How do I use the cPanel/WHM API?

    Well, it looks like your query is built in the correct order; $user, $module, $function, $args
    but the output looks like its saying your array isn't correct.

    Would you mind pasting in the script you're using?

  8. #8
    Registered User
    Join Date
    Feb 2012
    Posts
    4
    cPanel/Enkompass Access Level

    Reseller Owner

    Default Re: How do I use the cPanel/WHM API?

    Never mind I fixed it, it was not to do with that, it was something I was messing up before I called that.
    Thanks for all the help, problem solved!

Similar Threads & Tags
Similar threads

  1. cpanel api from WHM
    By broncha in forum cPanel Developers
    Replies: 13
    Last Post: 07-20-2009, 03:59 PM
  2. WHM / cPanel API
    By paulipv in forum cPanel Developers
    Replies: 9
    Last Post: 07-09-2009, 02:30 PM
  3. cPanel/WHM API?
    By hb-travisbell in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 11-26-2006, 05:42 PM
  4. cPanel/WHM API help
    By webadpro in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 03-02-2006, 02:18 PM
  5. Cpanel/Whm API
    By farshad_s3 in forum cPanel and WHM Discussions
    Replies: 17
    Last Post: 09-17-2004, 12:14 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube