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!

Calling hook from WHM API 1 for account create

Discussion in 'cPanel Developers' started by edlemmers, Jul 1, 2016.

  1. edlemmers

    edlemmers Member

    Jan 30, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    I have a script registered to the account create API. I also have a cURL operation that is using a JSON-encoded URL to run the account created command thru the API. This part is working in that it does create the CPanel account properly. What is the correct way pass a variable to the hooked script I have registered? This is the URL that I have:

    $query "https://" $server_creds['whmserver'] . ":2087/json-api/createacct?api.version=1&username=$username&domain=$domain&plan=$plan&password=$password&contactemail=$contactemail&owner=" $server_creds['reseller'] . "&@hook_args=$username&quota=$quota";
    $server_creds is an array which includes the hash code and everything else need to authorize the API call. The other parameters are passed using jQuery AJAX but could also be just a form POST.
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager
    Staff Member

    Apr 11, 2011
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator

    You could trap the custom variable in your custom script, store it to file, and then retrieve the variable from that file. However, could you elaborate a little more on the purpose of this configuration so we can better understand what you are attempting to do?

    Thank you.
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...

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