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.

Note for software parameter (PRO Version ONLY)

The Software component is useful if you want to perform updates and update checks from your app, see statistics (in future).

Our PRO version requires the “software” query param to be passed in order to activate a license through this REST endpoint.

Therefore you have two choices, either use software component or disable as explained below.

If using software (recommended)

  • Go to WordPress admin > License Manager > Software. Create a new software item for each software simple product/product variation you sell.
  • Edit the product from WordPress admin > Products > Edit Product > License Manager Tab > Software product > Select the software item to assign this to the product.
  • Grab the ID of the newly created software item and append it to your query as software=ID_of_the_software

If not using software

If you decided you don’t need anything of the above, you can disable the requirement with our simple plugin. To activate the plugin, simply download it and drop it in your site’s /wp-content/mu-plugins directory. The plugin will be treated as “Must use” plugin and will be automatically activated as long as it is found in this mu-plugins directory.

Endpoint

GET
/wp-json/dlm/v1/licenses/activate/{license_key}

Parameters

Name Type Default Is required
label string No
software 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.