Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Can you create a MySQL DB via API json call?

Discussion in 'cPanel Developers' started by Chuck Burgess, Oct 21, 2011.

  1. Chuck Burgess

    Chuck Burgess Registered

    Joined:
    Oct 21, 2011
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    51
    Location:
    Cedar Hills, Utah, United States
    cPanel Access Level:
    Website Owner
    I am looking to automate the creation of a MySQL database via a json api call. To list dbs, I can just use something like:

    https://example.com:2083/json-api/cpanel?user=username&cpanel_jsonapi_module=MysqlFE&cpanel_jsonapi_func=listdbs&cpanel_jsonapi_version=2

    This is successful via HTTP Sockets and CURL. Is there any equivalent call for adddb?


    https://example.com:2083/json-api/cpanel?user=username&cpanel_jsonapi_module=Mysql&cpanel_jsonapi_func=adddb&cpanel_jsonapi_version=1&dbname=newdb

    This doesn't work. I get the following error:


    “username_†is an invalid database name. It contains invalid characters.

    Any help?
     
  2. Infopro

    Infopro cPanel Sr. Product Evangelist
    Staff Member

    Joined:
    May 20, 2003
    Messages:
    16,563
    Likes Received:
    437
    Trophy Points:
    583
    Location:
    Pennsylvania
    cPanel Access Level:
    Root Administrator
    Twitter:
    I've moved your post to the Developers Forum in the hopes one of the cPanel Developers will see it and help if possible.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. sirdopes

    sirdopes Well-Known Member
    PartnerNOC

    Joined:
    Sep 25, 2007
    Messages:
    141
    Likes Received:
    0
    Trophy Points:
    66
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice