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.

Calling hook from WHM API 1 for account create

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

Tags:
  1. edlemmers

    edlemmers Member

    Joined:
    Jan 30, 2013
    Messages:
    7
    Likes Received:
    0
    Trophy Points:
    1
    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:

    PHP:
    $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 Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,762
    Likes Received:
    662
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    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.
     
Loading...

Share This Page