- add – adds a client
- change_password – changes a password for client
- activate – activates a client
- block – blocks a client
- delete – deletes a client
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.
$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 is served as json encoded string. The data is quite self explanatory. Every request has following fields:
- function – name of the function executed
- success = 1 – indicates successful request
- (other fields) – some functions might define extra fields in response
- error = 1 – indicates error situation
- reason – error code, lowercase underscore separated words
- message – human readable error explanation
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.
- 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
Changes password for your client.
- client_password – new password for client
Activate previously blocked client
Block client who was added or activated.
Completely remove customer. Only works if the customer has no valid subscription available.
Example usage of API in PHP can be found here