One REST API call. Any language. Any platform.
Download this file from your dashboard and place it next to your executable.
[Licentio]
ProgramID=your-program-uuid
ClientID=your-client-uuid
APIKey=your-api-key
The simplest way to test the API from any terminal.
curl -X POST https://licentio.dev/validate \
-H "Content-Type: application/json" \
-d '{
"program_id": "your-program-uuid",
"client_id": "your-client-uuid",
"api_key": "your-api-key"
}'
{
"valid": true,
"message": "License valid",
"license_type": "EXPIRY_DATE",
"days_remaining": 17,
"warning": true,
"warning_message": "License expires in 17 days"
}
Uses NetWebClient from CapeSoft NetTalk. The response is parsed using jFiles.
! Group to receive JSON response
element GROUP,NAME('element')
valid BYTE,NAME('valid | boolean')
message STRING(255),NAME('message')
license_type STRING(255),NAME('license_type')
days_remaining REAL,NAME('days_remaining')
warning BYTE,NAME('warning | boolean')
warning_message STRING(255),NAME('warning_message')
END
! In PageReceived method:
net.RemoveHeader()
st.SetValue(net.ThisPage.GetValue())
jSon.Start()
jSon.SetTagCase(jF:CaseAsIs)
jSon.Load(element, st)
IF self.ServerResponse = 200
IF element.valid = TRUE
IF element.warning_message <> ''
! Show warning to user
END
ELSE
! Show error: element.message
END
END
! Sending the request:
net.Start()
net.SetValue('', sBody, net:NoUrlEncode, 'application/json', '')
net.ContentType = 'application/json'
net.Post('https://licentio.dev/validate')
Uses the native HTTPSend function — no external libraries required.
PROCEDURE ValidateLicense() : boolean
sJSON is ANSI string
oRequest is httpRequest
oResponse is httpResponse
vResult is Variant
sIniPath is string
sIniPath = fExeDir() + "\" + LICENTIO_INI
IF NOT fFileExist(sIniPath) THEN
Error("License configuration file not found.")
RESULT False
END
sProgramID = INIRead("Licentio", "ProgramID", "", sIniPath)
sClientID = INIRead("Licentio", "ClientID", "", sIniPath)
sAPIKey = INIRead("Licentio", "APIKey", "", sIniPath)
IF sProgramID = "" OR sClientID = "" OR sAPIKey = "" THEN
Error("Invalid license configuration.")
RESULT False
END
sJSON = [{"program_id":"%1","client_id":"%2","api_key":"%3","machine_id":"%4"}]
sJSON = StringBuild(sJSON, sProgramID, sClientID, sAPIKey, NetMachineName())
oRequest..URL = "https://licentio.dev/validate"
oRequest..Method = httpPost
oRequest..ContentType = "application/json"
oRequest..Content = sJSON
oResponse = HTTPSend(oRequest)
IF oResponse..StatusCode <> 200 THEN
Error("License validation failed. Please check your internet connection.")
RESULT False
END
vResult = JSONToVariant(oResponse..Content)
IF NOT vResult.valid..Value THEN
Error("License invalid: " + vResult.message..Value)
RESULT False
END
IF vResult.warning..Value THEN
Info(vResult.warning_message..Value)
END
RESULT True
! At program startup:
IF NOT ValidateLicense() THEN
EndProgram()
END
Uses the requests library. Install with pip install requests.
import configparser
import requests
import sys
def validate_license(ini_path="licentio.ini"):
config = configparser.ConfigParser()
config.read(ini_path)
program_id = config["Licentio"]["ProgramID"]
client_id = config["Licentio"]["ClientID"]
api_key = config["Licentio"]["APIKey"]
response = requests.post(
"https://licentio.dev/validate",
json={
"program_id": program_id,
"client_id": client_id,
"api_key": api_key
}
)
data = response.json()
if not data["valid"]:
print(f"License invalid: {data['message']}")
return False
if data.get("warning"):
print(f"Warning: {data['warning_message']}")
return True
if not validate_license():
sys.exit(1)
Ready to protect your software?
Get Started Free