We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • WHM API 1 Functions - purchase_a_trial
Skip to end of metadata
Go to start of metadata

Description

This function retrieves and installs a trial license from the cPanel Store.

Examples 


 JSON API
URL
https://hostname.example.com:2087/cpsess##########/json-api/purchase_a_trial
MethodPOST
Content-Typeapplication/json
Request body{ "api.version": 1, "provider": "cPStore", "login_token": "1a676e6f-99fc-11e6-9ab6-e60a769b73bc", "checkout_args": { "send_verification": 1 } }
 Command Line

Notes

  • The format for this command line example differs from our standard format because the function only accepts a single JSON structure.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command. 


echo '{ "provider": "cPStore", "login_token": "1a676e6f-99fc-11e6-9ab6-e60a769b73bc", "checkout_args": { "send_verification": 1 } }' | ./bin/whmapi1 --input=json --output=json purchase_a_trial 


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
   "metadata" : {
      "reason" : "OK",
      "command" : "purchase_a_trial",
      "result" : 1,
      "version" : 1
   },
   "data" : {
      "licensed_ip" : "192.0.2.0"
   }
}

Note

WHM's API Shell interface (WHM >> Home >> Development >> API Shell) does not support this function.


Parameters

You can only call this function as a JSON request.


ParameterTypeDescriptionPossible valuesExample
providerstring

Required

The cPanel Store.

  • cPStore
  • A valid provider name.
cPStore
login_tokenstring

Required

The login token to access the cPanel Store.

A valid login token.1a676e6f-99fc-11e6-9ab6-e60a769b73bc
checkout_argsstring

A hash ref of arguments to send to the provider's checkout method.

The specific args required, if any, will be specific to each provider.send_verification

Returns

ReturnTypeDescriptionPossible valuesExample
licensed_ipstring

The licensed IP address.

Any valid IP address. 192.0.2.0