/1/learner - POST
Overview
The /1/learner endpoint provides for the creation of new learners.
Endpoint Details
Required Headers
Key | Value | Example |
---|---|---|
User-Agent | <company identifier> | The exact value here is not important, but it should include something to identify your company |
Accept | application/json | |
Authorization | Bearer <your token> | Bearer wV1MLk5+sFzioJw/3M5r9A== |
X-UserId | <the user id> | The id of the user to view the learners for (See REST API Guide and /1/user - POST) NOTE: This value must be provided by iFrame customers and only one of X-UserId or X-UserCode should be specified. All other customers must omit this header field. |
X-UserCode | <the user code> | The code of the user to view the learners for (See REST API Guide and /1/user - POST) NOTE: This value must be provided by iFrame customers and only one of X-UserId or X-UserCode should be specified. All other customers must omit this header field. |
Content-Type | application/json |
Fields
Field | Type | Optional | Description |
---|---|---|---|
code | String | Optional | A unique code that correlates the student to an external database and/or obfuscates the student's name (maximum length 191 chars); correlates to X-LearnerCode |
color | String | Optional | A CSS color to associate with the client (e.g. #ffffff) |
dateOfBirth | Date | Required | The date of birth for the learner |
firstName | String | Optional | |
lastName | String | Optional | |
gender | Integer | Optional | 1 = male, 2 = female |
isActive | Bool | Optional | A flag that indicates whether the learner is being actively assessed (default = true) |
Example
curl -X POST \
-H 'User-Agent: dmid-rest-api' \
-H 'Authorization: Bearer wV1MLk5+sFzioJw/3M5r9A==' \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{ "code": "Code: 1234", "color": "#ffff", "dateOfBirth": "2014-01-01", "firstName": "Fred", "gender": 1, "isActive": true, "lastName": "value" }' \
https://api-sandbox.datamtd.com/1/learner
Response
{ "gender": 1, "color": "#ffff", "firstName": "Fred", "id": 570, "code": "Code: 1234", "dateOfBirth": "2014-01-01T00:00:00Z", "isActive": 1, "organizationId": 1, "updatedAt": "2019-06-13T05:16:09Z", "createdAt": "2019-06-13T05:16:09Z", "lastName": "value" }