API

Supported functions:

Examples:

 

Documentation

Building an API request

All requests are RESTful. Parameters have to be passed in as normal HTTP request parameters. Every request must have following parameters in request

  • function – name of the command to execute
  • api_key – found under your training Settings -> API
  • sign – computed signature for API request. For more details, see next section: “Building a signature”

The order of parameters is not important for request but is important when calculating signature for your request.

All API requests must be posted to https://api.traindom.com/

Building a signature

Signature uses SHA1 hashing algorithm found in many programming languages. The input for SHA1 is compiled parameters in specific order. Every input starts with parameter function name, followed by api_key and ends with parameter api_secret. Parameter sign is not used when compiling input string.

Example

$function = "change_password";
$api_key = '<your traindom api key>';
$api_secret = '<your traindon api secret>';
$input = $function . $api_key . $client_id . $client_password . $api_secret;
$sign = sha1($input);

Order of parameters

All functions define a set of parameters. Some are optional, most are required. If not specified otherwise, all parameters are required when calculating request signature. All the parameters under specific function are described in the order as they have to be used when calculating request signature.

Response

Response is served as json encoded string. The data is quite self explanatory. Every request has following fields:

Always

  • function – name of the function executed

When successful

  • success = 1 – indicates successful request
  • (other fields) – some functions might define extra fields in response

When error

  • error = 1 – indicates error situation
  • reason – error code, lowercase underscore separated words
  • message – human readable error explanation

 

Functions

add

Add a new client to your training. The new client will be created as active and and paid. The paid amount will be smallest configured price for you training.

Parameters

  • client_email
  • client_name
  • client_password (optional) – password will be autogenerated if left blank
  • company_name (optional)
  • company_address (optional)
  • amount_paid – to activate client, specify the amount. Has to match with real price. If not specified, the client will not be activated
  • send_email (optional, not used in signature) – also send activation notice email to client

Response

  • client_id
  • client_password

change_password

Changes password for your client.

Parameters

  • client_id
  • client_password – new password for client

 

activate

Activate previously blocked client

Parameters

  • client_id

block

Block client who was added or activated.

Parameters

  • client_id

delete

Completely remove customer. Only works if the customer has no valid subscription available.

Parameters

  • client_id

 

Examples

Example usage of API in PHP can be found here