WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
Request
This function retrieves a hosting plan's package extension templates. When you call this function, the system checks the hosting plan's _PACKAGE_EXTENSIONS value. The function returns the contents of the /var/cpanel/packages/extensions/name.tt2 file for each package extension in the list, where name represents the package extension's name.
For more information, read our Guide to Package Extensions.
Note:
This function returns only metadata if the hosting plan does not use package extensions, or if the extensions' template files are empty.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/_getpkgextensionform
- A server running WHM.
https://whm-server.tld:2087/json-api/_getpkgextensionform
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/_getpkgextensionform?pkg=package1'{ "data": { "html": "<div class=\"fatBorder\" id=\"dog_Extension\"> <fieldset class=\"groupEditor\"> <div class=\"propertyGroup\"> <h3>Dog Settings</h3> <div class=\"propertyEditor\"> <div class=\"propertyLabel\">Dog Species</div> <div class=\"propertyValue\"><input id=\"dog_species\" type=\"text\" name=\"dog_species\" value=\"dalmatian\"></div> </div> <div class=\"propertyEditor\"> <div class=\"propertyLabel\">Tail Length</div> <div class=\"propertyValue\"> <input type=\"radio\" id=\"dogTailLengthTiny\" name=\"dog_tail_length\" value=\"tiny\"> <label for=\"dogTailLengthTiny\">Tiny</label><br> <input type=\"radio\" id=\"dogTailLengthNormal\" name=\"dog_tail_length\" value=\"normal\"> <label for=\"dogTailLengthNormal\">Normal</label><br> <input type=\"radio\" id=\"dogTailLengthLong\" name=\"dog_tail_length\" value=\"long\"> <label for=\"dogTailLengthLong\">Long</label> </div> </div> <div class=\"propertyEditor\"> <div class=\"propertyLabel\"><label for=\"dog_spots\">Has Spots</label></div> <div class=\"propertyValue\"> <input id=\"dog_spots\" type=\"checkbox\" name=\"dog_spots\" value=\"y\" checked=\"checked\"> </div> </div> </div> </fieldset> </div>" }, "metadata": { "command": "_getpkgextensionform", "reason": "OK", "result": 1, "version": 1 } }
Request
This function adds a package extension to a hosting plan (package).
Notes:
If you need to edit a package extension's parameters, call this function again with the same package extension name and the updated package extension variables.
You can include the extension's variables in your function call, in
key=valueformat. Consult the extension's documentation for a list of possible variables. Extension variables are case-sensitive.
The hosting plan's package extensions.
Note:
- Use space-delimited format to add multiple package extensions.
- Extension names are case-sensitive.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/addpkgext
- A server running WHM.
https://whm-server.tld:2087/json-api/addpkgext
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/addpkgext?name=package1'{ "data": { "pkg": "package1" }, "metadata": { "command": "addpkgext", "reason": "OK", "result": 1, "version": 1 } }
Request
This function deletes a package extension from a hosting plan (package).
Note:
- You can additionally include extension's variables in your function call, in
key=valueformat. Consult the extension's documentation for a list of possible variables. Extension variable names are case-sensitive.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/delpkgext
- A server running WHM.
https://whm-server.tld:2087/json-api/delpkgext
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/delpkgext?name=package1'{ "data": { "pkg": "package1" }, "metadata": { "command": "delpkgext", "reason": "OK", "result": 1, "version": 1 } }