/1/authorize - POST
Overview
The /1/authorize endpoint allows users to assess learners that are owned by other users.
Description
When a learner is created via /1/learner - POST, it can only be assessed by the user that was provided when the learner was created. If multiple users (created by /1/user - POST) need to perform assessments on a single learner, /1/authorize - POST can be used to authorize subsequent users to perform assessments on the learner.
Beta API
NOTE: This API is currently in beta and applies only to the 'iFrame' API customers.
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 |
Authorization | Bearer <your token> | Bearer wV1MLk5+sFzioJw/3M5r9A== |
Content-Type | application/json | |
X-LearnerId | <the learner id> | The DMTD-supplied identifier that identifies the learner (see REST API Guide and /1/learner - POST) |
X-LearnerCode | <the learner code> | A REST-client-supplied identifier that identifies the learner (see REST API Guide and /1/learner - POST) |
Fields
Field | Type | Required | Description |
---|---|---|---|
userId | Int | Optional | The id of the user to give permission to assess the learner (See REST API Guide and /1/user - POST) |
userCode | String | Optional | The code of the user to give permission to assess the learner (See REST API Guide and /1/user - POST) |
HTTP Status
HTTP Status | Description |
---|---|
200 - OK | The call succeeded and the user now has permission to assess the given learner. |
202 - Accepted | The given user already had permission to assess the given learner. |
400 - Bad Request | The body of the request was invalid |
401 - Unauthorized | The caller identified by the Bearer token does not have permission to perform this operation |
404 - Not Found | No user with the given userId/userCode could be located |
Example
Example
curl -X POST \
-H 'User-Agent: dmtd-rest-api' \
-H 'Authorization: Bearer L2Hth4lRwgHRBWtX8Hkl5w==' \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "X-LearnerId: 1" \
-d '{ "userId": 1234 }' \
https://api-sandbox.datamtd.com/1/authorize