FaxStore
The following examples demonstrate how an application can send a request to the FaxStore License System API to verify a license key.
Table of Contents
{
"status": "AUTHORISED",
"pass": true,
"details": "Authorisation completed - https://license.example.com"
}The Fetch API is available natively in Node.js v18 and newer. Older versions of Node.js may require the node-fetch package.
const url = 'https://license.example.com/api/check/PRODUCT_ID';
const options = {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'LICENSE_KEY',
}
};
fetch(url, options).then(response => response.json())
.then(data => {
console.log(data);
}).catch(error => {
console.error('Error:', error);
});local productId = 1
local licenseKey = 'ABC_123'
PerformHttpRequest("https://license.example.com/api/check/" .. productId, function(errorCode, resultData, resultHeaders)
local data = json.decode(resultData)
if data['pass'] then
print('^2Authorisation completed!^7')
else
print('^1' .. data.details .. '^7')
os.exit(0)
end
end, "POST", "", {
["Accept"] = "application/json, text/plain, */*",
["User-Agent"] = "*",
["Authorization"] = licenseKey
})<?php
$url = "https://license.example.com/api/check/9"; // 9 is the product ID
$license = "ABC_123";
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$headers = array(
"Accept: application/json",
"Content-Type: application/json",
"Authorization: $license",
);
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
$resp = curl_exec($curl);
curl_close($curl);
$data = json_decode($resp);
if ($data->pass == true) {
echo "License Passed";
} else {
echo "License Failed";
exit;
}
?>import http.client
conn = http.client.HTTPSConnection("license.example.com")
payload = ""
headers = {
'Authorization': "LICENSE_KEY",
'Accept': "application/json"
}
conn.request("POST", "/api/check/1?info=INFO_FOR_REQUEST_OPTIONAL", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))$headers=@{}
$headers.Add("Authorization", "LICENSE_KEY")
$headers.Add("Accept", "application/json")
$response = Invoke-WebRequest `
-Uri 'https://license.example.com/api/check/1?info=INFO_FOR_REQUEST_OPTIONAL' `
-Method POST `
-Headers $headersVersion 1 API request formats have been removed. The examples above reflect the current license API structure used by FaxStore.