Overview
Authentication
Methods
Error codes
Message
examples
Overview
The eLeaP API consists of a set of callable methods.To perform
an action using the API, send a request to an API endpoint
and a response will then be sent back to you. If you don't
have an API account, contact
eLeaP to register and activate your API account.
The request can either be GET or POST. We recommend you use
POST requests.
The response you'll get will be a JSON
encoded object.
Authentication
All requests to the API must contain the parameter api_token.
You can get this key from your eLeaP account, if you are an
administrator. You'll find the api_token in ACCOUNT > API.
If you think the key has been compromised, you must reset
it from ACCOUNT > API > Reset API Key.
Methods
Users
List
ACTION:
- returns the list of users (trainees and instructors) from
your company account.
URL:
- https://[company].2leap.com/api/users/ (replace
[company] with your 2leap subdomain)
ARGUMENTS:
- api_token (Required)
Get
ACTION:
- returns profile details for an user from your company
account (trainee or instructor).
URL:
- https://[company].2leap.com/api/users/get (replace
[company] with your 2leap subdomain)
ARGUMENTS:
- api_token (Required)
- email (Required)
Add
ACTION:
- inserts a new user
URL:
- https://[company].2leap.com/api/users/add (replace
[company] with your 2leap subdomain)
ARGUMENTS:
- api_token (Required)
- first_name (Required)
- middle_name
- last_name (Required)
- email (Required)
- access_level (1 for instructors, 0 for trainees, if missing
0 is assumed)
- description
Edit
ACTION:
- updates profile information for an existing user (trainee
or instructor)
URL:
- https://[company].2leap.com/api/users/edit (replace
[company] with your 2leap subdomain)
ARGUMENTS:
- api_token (Required)
- first_name (Required)
- middle_name
- last_name (Required)
- email (Required)
- access_level (1 for instructors, 0 for trainees, if missing
0 is assumed)
- description
Remove
ACTION:
- removes an existing user (trainee or instructor) from
your company account
URL:
- https://[company].2leap.com/api/users/remove
(replace [company] with your
2leap subdomain)
ARGUMENTS:
- api_token (Required)
- email (Required)
Error codes
401: Request missing api token
'api_token' argument is missing or is empty
4011: Invalid API Key
'api_token' argument exists but is incorrect
403: You don't have permission for this resource
The resource you're requesting is not accessible through
API. Same error is triggered if the subdomain and the api_token
don't match.
404: Invalid API call
The URL is incorrect
4040: Custom message
Usually used when sent data fails validation. This typically
gives custom errors returned by the eLeaP system.
4041: Requested item(s) not found
There is no data to return (response is empty).
Message examples
Success message after add/edit/remove:
{"response":{"status":"success","code":"200","message":"OK"}}
User list:
{"response":{"status":"success","code":"200","message":"OK"},"users":[{"access_level":0,
"first_name":"John","middle_name":"","last_name":"Doe","email":"jojn.doe@example.com",
"description":"Lorem ipsum dolor sit amet","created":"2011-01-31
09:41:30"},{"access_level":1,
"first_name":"Lorem","middle_name":"Ipsum","last_name":"Dolor","email":"lorem@example.com",
"description":"test","created":"2010-11-11
00:00:00"}]}
Single user:
{"response":{"status":"success","code":"200","message":"OK"},"user":[{"access_level":1,
"first_name":"Lorem","middle_name":"Ipsum","last_name":"Dolor","email":"victoras@gmail.com",
"description":"TEST","created":"2010-11-11
00:00:00"}]}
API token is wrong:
{"response":{"status":"fail","message":"Invalid
API Key","code":4011}}
Custom error message:
{"response":{"status":"fail","message":"Cannot
add users. Account limits reached","code":4040}}
[Top]
|