Assignments
Update an assignment
Moves an assignment to another learner, published scenario, or both.
PATCH
https://dash.trainertwin.com/api/v1
/
assignments
/
{assignmentId}
Update an assignment
curl --request PATCH \
--url https://dash.trainertwin.com/api/v1/assignments/{assignmentId} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"userId": "user_123",
"scenario": "system-design-interview"
}
'const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: 'user_123', scenario: 'system-design-interview'})
};
fetch('https://dash.trainertwin.com/api/v1/assignments/{assignmentId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://dash.trainertwin.com/api/v1/assignments/{assignmentId}"
payload = {
"userId": "user_123",
"scenario": "system-design-interview"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"assignment": {
"id": "assignment_123",
"assignedAt": "2023-11-07T05:31:56Z",
"userId": "user_123",
"scenario": "react-mock-interview"
},
"changed": true,
"emailSent": true,
"practiceUrl": "<string>"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}Authorizations
Organization API key generated in Dashboard → account menu → Developer API (dash.trainertwin.com/developer).
Path Parameters
Assignment ID.
Body
application/json
⌘I
Update an assignment
curl --request PATCH \
--url https://dash.trainertwin.com/api/v1/assignments/{assignmentId} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"userId": "user_123",
"scenario": "system-design-interview"
}
'const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({userId: 'user_123', scenario: 'system-design-interview'})
};
fetch('https://dash.trainertwin.com/api/v1/assignments/{assignmentId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://dash.trainertwin.com/api/v1/assignments/{assignmentId}"
payload = {
"userId": "user_123",
"scenario": "system-design-interview"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text){
"assignment": {
"id": "assignment_123",
"assignedAt": "2023-11-07T05:31:56Z",
"userId": "user_123",
"scenario": "react-mock-interview"
},
"changed": true,
"emailSent": true,
"practiceUrl": "<string>"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}{
"error": "Resource not found"
}