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!

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 Technical Support Community Manager
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    45,214
    Likes Received:
    1,936
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello :)

    Does it make a difference if you run "/scripts/killmysqluserprivs $username" after terminating the account?

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  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

  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