On this page
submitTrainingAttempt
mutation · in the family Your own session
What it does
Hand in your sitting — one answer per drawn question, graded on the server against the stored draw.
Hand in YOUR OWN open sitting — one option index (0-based) per drawn question, in the draw order (a wrong count, or an index past its question's options, refuses VALIDATION): graded SERVER-SIDE against the STORED draw — score 0..100, passed = score at or above passMark. A PASS mints your TrainingCertificate, tells you (the training_certificate_issued notice) and supersedes your earlier certificate for the course, all in the SAME transaction. open → submitted (terminal): a submitted or doomed sitting refuses CONFLICT/FSM_TRANSITION_INVALID; another person's sitting refuses AUTHZ/FORBIDDEN. Requires the unrestricted capability on a USER session + the CURRENT revision.
What happens
Final for that sitting; a pass mints your certificate in the same stroke.
Who may call it
Capability area: Your own session — What every signed-in person may do for themselves — their session, their profile and their own work.
- Owner
- System Administrator
- Manager
- Associate Manager
- Warehouse Associate
- Sales Associate
- Cashier
- An API key whose scope allows
api:submitTrainingAttempt
Arguments
| Name | Type | Required | Notes |
|---|---|---|---|
id | ID ID! | yes | The id of the record. |
revision | ID ID! | yes | The revision id you read on the record; the change is refused if an edit landed in the meantime. |
answers | Int [Int!]! | yes | No further notes. |
Returns
TrainingAttempt TrainingAttempt! — A TrainingAttempt (🎓 — THE TRAINING PROGRAM, THE WIRE): ONE sitting of a course's test by ONE person — ALWAYS the caller who started it (nobody starts one for someone else). At start the platform draws 10 ACTIVE questions of the course (every active question when fewer; below 3 the start refuses CONFLICT/TRAINING_TOO_FEW_QUESTIONS) and stores EXACTLY that draw (questionIds); passMark is copied from the strictest requirement binding the person for the course, else the default; curriculumVersion is the play's content hash at the sitting. At submit the answers are GRADED SERVER-SIDE against the STORED draw (a later bank edit never re-grades it) — score 0..100, passed = score >= passMark; a PASS mints the TrainingCertificate in the SAME transaction (certificateId). open (live) → submitted (terminal, kept) by the subject · open → doomed (terminal) by manage authority. ONE open sitting per (person, course) — a second start refuses CONFLICT/TRAINING_ATTEMPT_OPEN; at most 5 sittings per (person, course) per UTC day (CONFLICT/TRAINING_CAP). The by-id read answers the subject or the training-manage right; the listing is the manage right's. NOT searchable.
Example request
mutation ExampleSubmitTrainingAttempt($id: ID!, $revision: ID!, $answers: [Int!]!) {
submitTrainingAttempt(id: $id, revision: $revision, answers: $answers) {
id
sysId
type
caption
status
parentId
rootId
createdAt
updatedAt
revisionNum
revision
userId
orgId
courseKey
questionIds
answers
score
passed
passMark
startedAt
submittedAt
curriculumVersion
certificateId
}
}
Variables:
{
"id": "01900000-0000-7000-8000-37386ae00000",
"revision": "01900000-0000-7000-8000-b7960e180000",
"answers": [
1
]
}
Send it with the envelope naming the version: "extensions": {"at": {"version": {"name":"genesis","number":0}}}.
Example response
{
"data": {
"submitTrainingAttempt": {
"id": "01900000-0000-7000-8000-37386ae00000",
"sysId": "TT-EXMP-0000-000F",
"type": "TrainingAttempt",
"caption": "Blue jeans",
"status": "open",
"parentId": "01900000-0000-7000-8000-065235280000",
"rootId": "01900000-0000-7000-8000-a093dd800000",
"createdAt": "2027-01-31T00:00:00.000Z",
"updatedAt": "2027-01-31T00:00:00.000Z",
"revisionNum": 1,
"revision": "01900000-0000-7000-8000-b7960e180000",
"userId": "01900000-0000-7000-8000-11f967df0000",
"orgId": "01900000-0000-7000-8000-b0cf4f3c0000",
"courseKey": "<course key>",
"questionIds": [
"01900000-0000-7000-8000-e1e983890000"
],
"answers": [
1
],
"score": 1,
"passed": true,
"passMark": 1,
"startedAt": "2027-01-31T00:00:00.000Z",
"submittedAt": "2027-01-31T00:00:00.000Z",
"curriculumVersion": "<curriculum version>",
"certificateId": "01900000-0000-7000-8000-b335ac0d0000"
}
},
"extensions": {
"at": {
"callId": "01EXAMPLE-CALL-ID",
"version": {
"requested": {
"name": "genesis",
"number": 0
},
"serviced": {
"name": "genesis",
"number": 0
}
}
}
}
}
Errors this call can answer
VALIDATION/INVALID— Something in the request is not valid. (VALIDATION)AUTHN/REQUIRED— Sign in to do this. (AUTHN)AUTHZ/FORBIDDEN— Your role does not allow this action. (AUTHZ)RATE_LIMIT/THROTTLED— Too many requests in a short time. (RATE_LIMIT)NOT_FOUND/*— That record could not be found. (NOT_FOUND)CONFLICT/*— The record’s state, or a change made in the meantime, does not allow this; the codes are on the CONFLICT page. (CONFLICT)VALIDATION/VERSION_REQUIRED— The request did not say which app version it came from. (VALIDATION)