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.

Numerous errors during JSON API call chain

Discussion in 'cPanel Developers' started by Drakula, Oct 7, 2014.

  1. Drakula

    Drakula Registered

    Joined:
    Oct 7, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    Hello.

    I use cPanel JSON API in WHM plugin. It works, but not so good as it ought to be.
    I make 5 calls, but sometimes something breaks.

    0. /json-api/removeacct?username=USERNAME
    Response: successfully removed

    wait 10s

    1. /json-api/createacct?username=USERNAME&password=PASSWORD&domain=DOMAIN&cgi=0&quota=1&maxpop=0&maxftp=1&maxsql=1&useregns=0&forcedns=1&reseller=0
    Bug 1 error: A database owner with the name “USERNAME” already exists

    wait 10s

    2. /XXX/json-api/cpanel?user=USERNAME&cpanel_jsonapi_module=Mysql&cpanel_jsonapi_apiversion=1&cpanel_jsonapi_func=adddb&arg-0=DBNAME

    wait 10s

    3. /json-api/cpanel?user=USERNAME&cpanel_jsonapi_module=Mysql&cpanel_jsonapi_apiversion=1&cpanel_jsonapi_func=adduser&arg-0=DB_USER&arg-1=DB_PASS

    wait 10s

    4. /json-api/cpanel?user=USERNAME&cpanel_jsonapi_module=Mysql&cpanel_jsonapi_apiversion=1&cpanel_jsonapi_func=adduserdb&arg-0=DBNAME&arg-1=DB_USER&arg-2=all
    Bug 2 error: "You do not own the user (DB_USER)!"
    I have to manually delete this user from DB.

    This bug reproduces on 11.44.0 (build 30) & 11.44.1 (build 18).
    Any hints appreciated.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,723
    Likes Received:
    660
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
  3. Drakula

    Drakula Registered

    Joined:
    Oct 7, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    No, i don't run "/scripts/killmysqluserprivs $username", because i call APIs from js frontend code. I'll try to make a custom cgi, which calls this script.
     
  4. Drakula

    Drakula Registered

    Joined:
    Oct 7, 2014
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    Root Administrator
    First bug disappeared, but the second persists. I create a new user and "You do not own the user". How is this possible?
     
Loading...

Share This Page