Table of Contents
Code Example #
$curl = curl_init();
$endpoint = '{{domain}}/wp-json/wclm/v3/activate';
$parameters = array(
// The License Key
'license_key' => 'FFFF-FFFF-FFFF-FFFF',
// The device ID
// The Device ID is optional, but if it is used and the license keys was activated with it
// it becomes required, a license key activated with a Device ID can't be deactivated
// without it and can't be activated again without it.
// The device ID can be anything you want, its role is to identify the "Device",
// "Machine" or "Domain" where the license was activated.
'device_id' => 'domain.ltd'
);
curl_setopt_array($curl, array(
CURLOPT_URL => $endpoint,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => $parameters,
CURLOPT_USERAGENT => $_SERVER['HTTP_USER_AGENT'],
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_HTTPHEADER => array(
// Authenticated user token
'Authorization: Bearer {{User Token}}'
)
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
API Responses #
{
"response": {
"result": "error",
"code": "100",
"message": "Invalid license key",
"api_timestamp": 'current timestamp'
},
"signature": "Signature or OpenSSL error"
}
{
"response": {
"result": "success",
"code": "300",
"message": "License key activated",
"api_timestamp": 'current timestamp'
},
"signature": "Signature or OpenSSL error"
}
{
"response": {
"result": "error",
"code": "350",
"message": "Maximum number of activation reached",
"api_timestamp": 'current timestamp'
},
"signature": "Signature or OpenSSL error"
}
{
"response": {
"result": "error",
"code": "550",
"message": "Expired license key",
"api_timestamp": 'current timestamp'
},
"signature": "Signature or OpenSSL error"
}
{
"response": {
"result": "error",
"code": "750",
"message": "Device ID required, this license keys was activated with a device ID, a device ID is required to activate it again",
"api_timestamp": 'current timestamp'
},
"signature": "Signature or OpenSSL error"
}
{
"response": {
"result": "error",
"code": "900",
"message": "The authenticated user doesn't own this license key",
"api_timestamp": 'current timestamp'
},
"signature": "Signature or OpenSSL error"
}
WordPress’s built-in REST API responses.
{
"code": "rest_forbidden",
"message": "Sorry, you are not allowed to do that.",
"data": {
"status": 403
}
}