This endpoint can be used to create Generator records in the database. List of parameters and example responses can be found below.
Endpoint
POST
/wp-json/dlm/v1/licenses
Parameters
Name | Type | Default | Is required |
---|---|---|---|
name | string |
Yes | |
charset | string |
Yes | |
chunks | number |
Yes | |
chunk_length | number |
Yes | |
expires_in | number |
No | |
activations_limit | number |
No | |
separator | string |
No | |
prefix | string |
No | |
suffix | string |
No |
Responses
{
"success": true,
"data": {
"id": 6,
"name": "Example Generator",
"charset": "ABCD1234",
"chunks": 4,
"chunkLength": 4,
"timesActivatedMax": "1",
"separator": "-",
"prefix": "",
"suffix": "",
"expiresIn": "365",
"createdAt": "2021-05-15 21:23:00",
"createdBy": "1",
"updatedAt": null,
"updatedBy": null
}
}
{
"code": "rest_data_error",
"message": "The Generator name is missing from the request.",
"data": {
"status": 404
}
}
Examples
Example
use IdeoLogix\DigitalLicenseManagerClient\Service;
$api = new Service( 'http://site.com', 'ck_XXXX', 'cs_XXXX' );
$response = $api->generators()->create([
'name' => 'Mobile Apps',
'charset' => 'ABCD1234',
'chunks' => 4,
'chunk_length' => 4,
'activations_limit' => 1,
'separator' => '-',
'prefix' => '',
'suffix' => '',
'expires_in' => 365 // days.
]);
print_r($response->get_data());
Response
Array
(
[id] => 5
[name] => Mobile Apps
[charset] => ABCD1234
[chunks] => 4
[chunk_length] => 4
[activations_limit] => 1
[separator] => -
[prefix] => NULL
[suffix] => NULL
[expires_in] => 365
[created_at] => 2021-08-28 12:06:43
[updated_at] =>
)
For more details please click here.