Generate

To generate a given amount of Licenses via specific Generator you can use this endpoint.

Note: The status column accepts the following values:

NumberMeaning
1Sold
2Delivered
3Active
4Inactive
5Disabled

Endpoint

POST
/wp-json/wlm/v1/generators/{generator_id}/generate

Parameters

Name Type Default Is required
amount number Yes
status number 4 No
save number 0 No
product_id number No
order_id number No
user_id number No

Responses

{
    "success": true,
    "data": [
        "DZWW-BWC1-DD0W-ZZCA",
        "W902-A112-C0A9-CCZC",
        "5B2A-DAB5-B91B-CA35",
        "0BWA-9C2C-3393-1A92",
        "CD22-A9C1-D3AD-CB3C"
    ]
}
{
    "code": "data_error",
    "message": "Invalid amount",
    "data": {
        "status": 400
    }
}

Examples

Example
use IdeoLogix\DigitalLicenseManagerClient\Service;

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

$response = $api->generators()->generate( 1, [
	'save'   => 1,
	'amount' => 5,
	'status' => 4,
	//'product_id' => '',
	//'order_id'   => '',
	//'user_id'    => '',
] );

print_r( $response->get_data() ); 
Response
Array
(
    [0] => DZWW-BWC1-DD0W-ZZCA
    [1] => W902-A112-C0A9-CCZC
    [2] => 5B2A-DAB5-B91B-CA35
    [3] => 0BWA-9C2C-3393-1A92
    [4] => CD22-A9C1-D3AD-CB3C
)
For more details please click here.