Code Example

$curl = curl_init();

$endpoint = '{{domain}}/wp-json/wclm/v3/get-product-api-meta';
$parameters = array(
        // Product ID
        'product_id' => '236'
    );

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

This data can be set per product on the product page > license keys section > API tab.

{
    "response": {
        "software_name": "License Manager",
        "software_id": "wclm",
        "software_version": "4.4",
        "software_author": "Firas Saidi",
        "software_url": "https://fs-license-manager.local/",
        "software_last_update": "02/04/2021",
        "software_extra_data": "extra data",
        "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
    }
}