Licence and quotas
Check that your credentials are accepted, and read your licence's information: messages left, maximum file size, permissions.
Prerequisites
Your credentials: see Credentials and environments.
Check the licence
IsLicenceIsValid checks the API serial, user and password, along with the email address of the licence holder.
var args = new IsLicenceIsValidArgs(endpoint, serial, apiUser, apiPassword, holderEmail);
bool valid = LicenceHelper.IsLicenceIsValid(args);
A false result does not prove that the licence is invalid: it also happens when the address is malformed or the server could not be reached. Use this check when your application starts, and log the result without the credentials.
Read the licence's information
GetSerialInfoResponse info = LicenceHelper.GetSerialInfo(
new GetSerialInfoArgs(endpoint, serial, apiUser, apiPassword));
if (info != null && info.PlanPermission != null)
{
int messages = info.NbTotalMessage;
long maxSize = info.LicenceAutorisation.MaxFileSize; // in bytes
}
In .NET, GetSerialInfo does not check the server status: on error, it returns a response whose values are zero, and whose PlanPermission and LicenceAutorisation are null. It returns null if the key exchange fails, and throws an exception if one of the credentials is empty. Test the response and PlanPermission, as in the example.
GetSerialInfo returns null (None) on error.
Returned information
| Field | Content |
|---|---|
NbTotalMessage |
Number of messages you have left to send. |
MaxFileSize (in LicenceAutorisation) |
Maximum total size of a message's files, in bytes. |
MaxMinMsgRetention (in LicenceAutorisation) |
Maximum retention of a message, in minutes. |
Permission |
Features allowed by the plan, as a combination of flags. |
PlanPermission |
Plan details, including its PlanID identifier. |
PurchaseDate |
Date the serial was created, in your account's time zone. |
ContextualKeys |
Your organization's contextual keys: see Callback parameter format. |
NbBusinessMessage and NbUserMessage come from a former message quota specific to the organization, which is no longer assigned: do not use them.
The response contains neither the licence holder's address nor the subscription's end date: no SDK exposes them. To check an address, use IsLicenceIsValid.
To adapt your application, read the limits (size, retention, permissions) rather than the plan's name: they follow plan changes.
Warning
Do not use the SerialTypePermission enumeration of the Python and PHP SDKs to decode permission: its values do not match the server's.
Plans
PlanPermission.PlanID is the plan's identifier, as a string. Compare it to the SDK constants rather than to a hand-written value:
| SDK | Access |
|---|---|
| .NET | LicenceHelper.PLANID_APIDEBASE, etc. |
| Python | PLANID_APIDEBASE, etc., in secure_exchanges_sdk.helpers.licence_helper |
| PHP | PlanId::APIDEBASE, etc. |
| Constant | PlanID value |
|---|---|
DEBASE |
DEBASE |
APIDEBASE |
APIDEBASE |
COMPLET |
COMPLET |
APICOMPLET |
APICOMPLET |
COMPLET2100 |
COMPLET2100 |
APICOMPLET2100 |
APICOMPLET2100 |
DEBASE_PARTAGER |
DEBASE-P |
COMPLET_PARTAGER |
COMPLET-P |
COMPLET2100_PARTAGER |
COMPLET2100-P |
SESAR |
SESAR |
COMPLET5000 |
COMPLET5000 |
COMPLET7500 |
COMPLET7500 |
COMPLET10000 |
COMPLET10000 |
COMPLET15000 |
COMPLET15000 |
COMPLET20000 |
COMPLET20000 |
COMPLET25000 |
COMPLET25000 |
NOTSET |
NotSet |
In .NET, read PlanID, not PlanPermission.Plan: the values of the Plan enumeration do not match the server's.
Device identifier (DeviceID)
With each token request, the SDK sends an identifier of the machine: the domain and account running your application (domain\user).
| SDK | Read the identifier |
|---|---|
| .NET | LicenceHelper.DeviceID |
| Python | LicenceHelper.get_device_id() |
| PHP | LicenceHelper::getDeviceId() |
- Credentials obtained from the portal, the usual case: the device identifier has no effect.
- Credentials activated from a machine (
CreateLicence, in .NET): they are bound to that identifier. Changing the service account or the domain makes them unusable. - Personal information: the identifier contains the name of the account running your application. Do not log it without a reason.
Common errors
| Symptom | Likely cause | Solution |
|---|---|---|
| .NET: exception "Invalid user, api or password. Someone is empty" | A credential is Guid.Empty: the secret was not loaded |
Check how your secrets are read. |
| .NET: all values at zero | Server error: credentials refused or wrong environment | Check that the credentials match the environment (preview or production). |
IsLicenceIsValid returns false |
Wrong or malformed holder address, wrong environment, network | Check the address and the environment. |
.NET: IsLicenceIsValid(endpoint, serial, ...) does not compile |
Signature from a former guide | Pass an IsLicenceIsValidArgs, as in the example. |
Next
- Credentials and environments
- Attachments: size limits