Skip to content
Last updated

GetClientsAddons

Obtain the Clients Product Addons that match passed criteria

Request Parameters

ParameterTypeDescriptionRequired
actionstring"GetClientsAddons"Required
serviceidint|stringThe service id(s) to obtain the client product addons for. Single number or comma separated listOptional
clientidintThe client to obtain the client product addons forOptional
addonidintThe predefined product addon id from tbladdons (tbladdons.id) to obtain client addons for.Optional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error
totalresultsintThe total number of results available
serviceidintThe specific service id searched for
clientidintThe specific client id searched for
addonsarrayThe client product addons list

Example Request (CURL)

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://www.example.com/includes/api.php');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,
    http_build_query(
        array(
            'action' => 'GetClientsAddons',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'clientid' => '1',
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'GetClientsAddons';
$postData = array(
    'clientid' => '1',
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

$results = localAPI($command, $postData, $adminUsername);
print_r($results);

Example Response JSON

{
    "result": "success",
    "serviceid": "",
    "clientid": "1",
    "totalresults": "1",
    "addons[addon][0][id]": "1",
    "addons[addon][0][qty]": "1",
    "addons[addon][0][userid]": "1",
    "addons[addon][0][orderid]": "0",
    "addons[addon][0][serviceid]": "1",
    "addons[addon][0][addonid]": "0",
    "addons[addon][0][name]": "Addon 1",
    "addons[addon][0][setupfee]": "0.00",
    "addons[addon][0][recurring]": "15.00",
    "addons[addon][0][billingcycle]": "Monthly",
    "addons[addon][0][tax]": "",
    "addons[addon][0][status]": "Active",
    "addons[addon][0][regdate]": "2015-12-03",
    "addons[addon][0][nextduedate]": "2016-10-03",
    "addons[addon][0][nextinvoicedate]": "2016-10-03",
    "addons[addon][0][paymentmethod]": "paypal",
    "addons[addon][0][paymentmethodname]": "PayPal",
    "addons[addon][0][notes]": ""
}

Version History

VersionChangelog
1.0Initial Version
8.12Added qty parameter