Activate

This endpoint can be used to activate a License.

When activating licenses the system checks against the activation limit. If the limit is passed error response will be returned, otherwise Activation row will be stored into the {prefix}_dlm_activations table.

Endpoint

GET
/wp-json/dlm/v1/licenses/activate

Parameters

Name Type Default Is required
label string No

Responses

{
    "success": true,
    "data": {
        "id": 16,
        "token": "94face23474767399c106d7598685764853b49b5",
        "license_id": 33,
        "label": "My Device",
        "source": 2,
        "ip_address": "192.168.20.1",
        "user_agent": "PostmanRuntime/7.28.3",
        "meta_data": [],
        "created_at": "2021-08-23 10:55:18",
        "updated_at": null,
        "deactivated_at": null,
        "license": {
            "id": 33,
            "order_id": 56,
            "product_id": 12,
            "user_id": 1,
            "license_key": "DWA9-AAZZ-3199-Z312",
            "expires_at": "2022-07-25 09:38:12",
            "valid_for": 365,
            "source": 1,
            "status": 2,
            "times_activated": 2,
            "activations_limit": 5,
            "is_expired": false,
            "created_at": "2021-07-25 09:38:12",
            "created_by": 1,
            "updated_at": "2021-07-25 09:38:12",
            "updated_by": 1
        }
    }
}
{
    "code": "license_activation_limit_reached",
    "message": "License Key: Z09Z-D0DZ-9A29-3BCD reached maximum activation count.",
    "data": {
        "status": 404
    }
}

Examples

Example
use IdeoLogix\DigitalLicenseManagerClient\Service;

$api = new Service( 'http://site.com', 'ck_XXXX', 'cs_XXXX' );

$params = [
    'label' => 'My Device'
    'meta_data' => [
        'mac' => 'XX:XX:XX:XX:XX:XX',
    ]
    // Note: meta_data is optional but a good way to provide more info
];
$response = $api->licenses()->activate( 'DWA9-AAZZ-3199-Z312', $params );

print_r($response->get_data());
Response
Array
(
    [id] => 16
    [token] => 94face23474767399c106d7598685764853b49b5
    [license_id] => 33
    [label] => 'My Device'
    [source] => 2
    [ip_address] => 127.0.0.1
    [user_agent] => DLM cURL Client v10
    [meta_data] => Array ()
    [created_at] => 2021-08-23 10:55:18
    [updated_at] => NULL
    [deactivated_at] => NULL
    [license] => Array
        (
            [id] => 33
            [order_id] => 56
            [product_id] => 12
            [user_id] => 1
            [license_key] => DWA9-AAZZ-3199-Z312
            [expires_at] => 2022-07-25 09:38:12
            [valid_for] => 365
            [source] => 1
            [status] => 2
            [times_activated] => 2
            [activations_limit] => 5
            [is_expired] => false
            [created_at] => 2021-07-25 09:38:12
            [updated_at] => 2021-07-25 09:38:12
        )
)
For more details please click here.