Skip to content
Last updated

UpdateClientProduct

Updates a Client Service

Request Parameters

ParameterTypeDescriptionRequired
actionstring"UpdateClientProduct"Required
serviceidintThe ID of the client service to update.Required
pidintThe package ID to associate with the service.Optional
serveridintThe server ID to associate with the service.Optional
regdatestringThe registration date of the service. Format: Y-m-dOptional
nextduedatestringThe next due date of the service. Format: Y-m-dOptional
terminationdatestringUpdate the termination date of the service. Format: Y-m-dOptional
domainstringThe domain name to be changed to.Optional
firstpaymentamountfloatThe first payment amount on the service.Optional
recurringamountfloatThe recurring amount for automatic renewal invoices.Optional
paymentmethodstringThe payment method to associate, in system format (for example, paypal).Optional
billingcyclestringThe term in which the product is billed on (for example, One-Time, Monthly, or Quarterly).Optional
subscriptionidstringThe subscription ID to associate with the service.Optional
statusstringThe status to change the service to.Optional
notesstringThe admin notes for the service.Optional
serviceusernamestringThe service username.Optional
servicepasswordstringThe service password.Optional
overideautosuspendstringWhether to provide override auto suspend ('on' or 'off').Optional
overidesuspenduntilstringUpdate the Override Suspend date of the service. Format: Y-m-dOptional
ns1string(VPS/Dedicated servers only)Optional
ns2string(VPS/Dedicated servers only)Optional
dedicatedipstringOptional
assignedipsstring(VPS/Dedicated servers only)Optional
diskusageintThe disk usage in megabytes.Optional
disklimitintThe disk limit in megabytes.Optional
bwusageintThe bandwidth usage in megabytes.Optional
bwlimitintThe bandwidth limit in megabytes.Optional
suspendreasonstringOptional
promoidintThe promotion ID to associate.Optional
unsetarrayAn array of items to unset. Can be one of: 'domain', 'serviceusername', 'servicepassword', 'subscriptionid', 'ns1', 'ns2', 'dedicatedip', 'assignedips', 'notes', or 'suspendreason'Optional
autorecalcboolWhether to automatically recalculate the recurring amount of the service (this will ignore any passed $recurringamount).Optional
customfieldsstringBase64 encoded serialized array of custom field values - base64_encode(serialize(array("1"=>"Yahoo")));Optional
configoptionsstringBase64 encoded serialized array of configurable option field values - base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array('optionid' => YYY, 'qty' => ZZZ)))) - XXX is the ID of the configurable option - YYY is the optionid found in tblhostingconfigoption.optionid - ZZZ is the quantity you want to use for that optionOptional

Response Parameters

ParameterTypeDescription
resultstringThe result of the operation: success or error
serviceidintThe ID of the updated service.

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' => 'UpdateClientProduct',
            // See https://developers.whmcs.com/api/authentication
            'username' => 'IDENTIFIER_OR_ADMIN_USERNAME',
            'password' => 'SECRET_OR_HASHED_PASSWORD',
            'serviceid' => '1',
            'status' => 'Terminated',
            'customfields' => base64_encode(serialize(array("1"=>"Yahoo"))),
            'configoptions' => base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array('optionid' => YYY, 'qty' => ZZZ)))),
            'responsetype' => 'json',
        )
    )
);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$response = curl_exec($ch);
curl_close($ch);

Example Request (Local API)

$command = 'UpdateClientProduct';
$postData = array(
    'serviceid' => '1',
    'status' => 'Terminated',
    'customfields' => base64_encode(serialize(array("1"=>"Yahoo"))),
    'configoptions' => base64_encode(serialize(array(configoptionid => dropdownoptionid, XXX => array('optionid' => YYY, 'qty' => ZZZ)))),
);
$adminUsername = 'ADMIN_USERNAME'; // Optional for WHMCS 7.2 and later

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

Example Response JSON

{
    "result": "success",
    "serviceid": "1"
}

Error Responses

Possible error condition responses include:

  • Service ID Not Found

Version History

VersionChangelog
1.0Initial Version