Difference between revisions of "API"
(→Example Code) |
|||
Line 1: | Line 1: | ||
− | The API | + | The WHMCS API provides an interface to allow you to access and perform actions in WHMCS both from external applications and scripts as well as internal modules and addons. |
− | ==API User Setup== | + | ==Internal API== |
+ | |||
+ | The internal API can be used from any file within WHMCS - be it a template, action hook, addon module, anything. It allows you to call any of the API functions via a local function call to avoid needing to use CURL. For more information on this, please refer to the [[API:Internal_API|Internal API Page]] | ||
+ | |||
+ | ==External API== | ||
+ | |||
+ | The External API supports 3 response types: Name/Value Pairs (NVP), XML & JSON (V4.5 or later) | ||
+ | |||
+ | Most calls support all response types, but certain data retrieval calls will only work under either XML or JSON due to the multi-level depth nature of their responses. | ||
+ | |||
+ | ===API User Setup=== | ||
When creating an admin user for API use, only the API permission is required to be able to access & use all the API functions. | When creating an admin user for API use, only the API permission is required to be able to access & use all the API functions. | ||
− | You must also setup the IP(s) you will be connecting from in '''General Settings > Security'''. Failure to do this will result in an Invalid IP response from the API. | + | You must also setup the IP(s) you will be connecting from in '''General Settings > Security'''. Failure to do this will result in an "Invalid IP xx.xxx.xxx.xx" response from the API. |
− | ==Example Code== | + | ===Example Code=== |
− | We have PHP code samples demonstrating how you can connect to and interpret each of the supported response types | + | We have fully working PHP code samples demonstrating how you can connect to and interpret each of the supported response types of the WHMCS API in the pages below: |
*[[API:Example_Usage|Sample NVP Code]] | *[[API:Example_Usage|Sample NVP Code]] | ||
*[[API:XML_Sample_Code|Sample XML Code]] | *[[API:XML_Sample_Code|Sample XML Code]] | ||
+ | *[[API:JSON_Sample_Code|Sample JSON Code]] | ||
==Functions== | ==Functions== |
Revision as of 20:31, 17 May 2011
The WHMCS API provides an interface to allow you to access and perform actions in WHMCS both from external applications and scripts as well as internal modules and addons.
Contents
Internal API
The internal API can be used from any file within WHMCS - be it a template, action hook, addon module, anything. It allows you to call any of the API functions via a local function call to avoid needing to use CURL. For more information on this, please refer to the Internal API Page
External API
The External API supports 3 response types: Name/Value Pairs (NVP), XML & JSON (V4.5 or later)
Most calls support all response types, but certain data retrieval calls will only work under either XML or JSON due to the multi-level depth nature of their responses.
API User Setup
When creating an admin user for API use, only the API permission is required to be able to access & use all the API functions.
You must also setup the IP(s) you will be connecting from in General Settings > Security. Failure to do this will result in an "Invalid IP xx.xxx.xxx.xx" response from the API.
Example Code
We have fully working PHP code samples demonstrating how you can connect to and interpret each of the supported response types of the WHMCS API in the pages below:
Functions
Need something else?
The API is being continually developed and added to as features are requested. If you have a need for a feature that is not currently available, feel free to contact us and let us know and we'll see what we can do.