Note: This example application can be run interactively at: http://mindflash.github.io/mf-api-example
Note: Run docker-compose up
to run this example locally in development mode.
Note: Documentation on merge, deploy process.
The Mindflash API is a simple REST service that allows clients to carry out simple tasks within their own account such as managing users, managing user groups, enrolling trainees in courses/series and getting basic reporting information. These requests are based on very simple HTTP protocol rules in conjunction with the JSON data format. A sample request and response could look like this:
Request:
GET https://api.mindflash.com/api/v2/user/333
Response:
{
"id": 333,
"name": "Doe, John",
"firstName": "John",
"lastName": "Doe",
"username": "jdoe",
"email": "jdoe@yourorg.com",
"status": "Active",
"type": "Trainee",
"isOwner": 0,
"groups": []
}
In order to use the Mindflash API you must first contact customer support to get an API key. This key will allow
you to make secure calls to the API by placing the key in the request header as the x-mindflash-apikey
field.
A sample request header should look like this:
Accept:application/json, text/plain, */*
Accept-Encoding:gzip,deflate,sdch
x-mindflash-apikey:8442c90ef89745e28620e406
Mindflash offers a useful mechanism that allows clients to log their own trainers and trainees in to the Mindflash application by simply requesting a session directly. This allows users to log into Mindflash using their own list of users and credentials on their own internal network. Here is a sample workflow:
1. User logs in to private intranet website.
2. After authenticating user on private network, webserver makes request to Mindflash API to get Mindflash session ID
and URL for user to login to the Mindflash application. The request and response look something like this:
GET https://api.mindflash.com/api/v2/auth?id=9999
Response: 200
{
userId: 9999,
userDisplayName: "Joe Black",
userEmail: "joe.black@yourorganization.com",
dashboardUrl: "http://yourorg.mindflash.com/CreateCookie.aspx?sessionID2=AcAVGBh34343SD"
}
3. Webserver serves page to intranet user which contains a the link returned by the Mindflash API. 4. Intranet user clicks link, which directs browser to the Mindflash application. The Mindflash session is attached to the URL, so user is automatically authenticated and logged into the Mindflash application.
API usage is subject to rate limits of 10 requests per 10 seconds per API key.
You can try testing your API key using the terminal window:
npm install;
npm run api queryObject.key xxxx-xxxx-xxxx-xxxx queryObject.method POST|GET queryObject.path path queryObject.body.key1 value1 ...
For example, to get the list of users:
npm run api queryObject.key xxxx-xxxx-xxxx-xxxx queryObject.path /api/v3/user
To update a custom field for a user (for example user called Alex with id: 5056086330525)
npm run api queryObject.key xxxx-xxxx-xxxx-xxxx queryObject.method POST queryObject.path /api/v3/user/5056086330525 queryObject.body.customField0 "Alex Arbass"
To add group:
npm run api queryObject.key xxxx-xxxx-xxxx-xxxx queryObject.method POST queryObject.path /api/v3/group queryObject.body.groupName "Alex Arbass Group"
To get user group with id 5064332596370:
npm run api queryObject.key xxxx-xxxx-xxxx-xxxx queryObject.path /api/v3/group/5064332596370
If you would like call-by-call documentation with examples, please go to http://mindflash.github.io/mf-api-example.