Introduction
This guide explains the basics of how to test calls to WHM API 0 or WHM API 1. This document lists appropriate test steps for most custom code, and helpful information to troubleshoot common problems. Make certain that you evaluate the testing requirements of your own code, and allow its functionality to determine the appropriate steps.
Warning:
cPanel Technical Support cannot always assist third-party developers with problems that relate to custom code. For this reason, always test your projects thoroughly before you attempt to use them on production servers.
Testing steps
Note:
Because the testing requirements of custom code differ, this document begins with the assumption that you already discovered problems.
Check to ensure that you called the correct API function.
Often, problems in custom code occur due to a typo, or because integrators use the wrong function or assume that it exists in the wrong API (for example, an assumption that a WHM API 1 function also exists in WHM API 0).
Important:
- cPanel users can only call cPanel API 1, cPanel API 2, and UAPI functions, and in many cases must have access to the correct features for those functions.
- WHM users can call cPanel API 1, cPanel API 2, and UAPI functions, but you must specify a cPanel user to call those functions as.
- If the method that you used to call the API includes a port number, makecertain that you used the correct port number:
- cPanel API 1, cPanel API 2, and UAPI calls use port
2082
(insecure) or2083
(secure). - WHM API 0 and WHM API 1 calls use port
2086
(insecure) or2087
(secure).
- cPanel API 1, cPanel API 2, and UAPI calls use port
- If your custom code calls WHM API 0 functions, we strongly recommend that you update your code to use WHM API 1 instead.
Check our documentation to ensure that the function you called exists in that API and performs the desired action:
- Guide to WHM API 0
- Guide to WHM API 1
Check whether your call includes all of the function's required parameters.
Many errors occur because the call did not pass all of the required parameters to the function. Check the function's documentation to ensure that you passed values for all of the required input parameters.
Check the input values that your code passes to the function.
If your code passes input values to the function, check these values for any formatting or other errors. For example, in Perl code, you may wish to use theData::Dumper
module to print passed values to a log file before you call the function.
Call the API function independently from your custom code.
Use one of the following methods to call the API function independently:
- Use WHM's API Shell interface (Home >> Development >> API Shell) to call the desired WHM API 1 function.
- Call the WHM API 0 or WHM API 1 function from the command line.
-
Perform a browser-based call to the desired WHM API 0 or WHM API 1 function.
Note:
You must URI-encode parameters and values for browser-based calls.
If the function runs successfully and returns the expected output, a problem exists in the way in which your custom code authenticates or calls the function.
If the function does not run successfully, and you are certain that you included the correct parameters with valid values, a bug may exist in cPanel & WHM. Submit a ticket to cPanel Support to further investigate the issue.
Troubleshoot common issues
Unknown app requested for this version of the API
Problem:
You receive the following error when you call a WHM function:
Unknown app (“functionname”) requested for this version (version) of the API. |
Solution:
This error occurs when you attempt to call a function that does not exist.
- Check to ensure that the desired function exists in the API version that you called. For example, if you attempt to call an API function that only exists in WHM API 1 through WHM API 0, you will receive this error.
- If the method that you used to call the API includes a port number, make certain that you used the correct port number:
- cPanel API 1, cPanel API 2, and UAPI calls use port
2082
(insecure) or2083
(secure). - WHM API 0 and WHM API 1 calls use port
2086
(insecure) or2087
(secure).
- cPanel API 1, cPanel API 2, and UAPI calls use port
- Check to ensure that the function name is correct.
- Function names are case-sensitive.
- Often, this error occurs due