AlmondTill/G3N API

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.

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.

Before you call

A signed-in user’s session — the call refuses an API key (AUTHZ/FORBIDDEN).

Capability area: Your own session — What every signed-in person may do for themselves — their session, their profile and their own work.

Roles that may call it:

What happens

Final for that sitting; a pass mints your certificate in the same stroke.

Arguments

NameTypeRequiredNotes
idID ID!yesThe id of the record.
revisionID ID!yesThe revision id you read on the record; the change is refused if an edit landed in the meantime.
answersInt [Int!]!yes

Concurrency

Send the record’s current revision from your last read as revision. A stale revision is refused as CONFLICT/REVISION_STALE — read the record again and retry with the new value.

Returns

TrainingAttempt TrainingAttempt! — A TrainingAttempt: 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. 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

graphql
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:

json
{
  "id": "01900000-0000-7000-8000-1ffd0a840000",
  "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

json
{
  "data": {
    "submitTrainingAttempt": {
      "id": "01900000-0000-7000-8000-1ffd0a840000",
      "sysId": "TT-EXMP-0000-000F",
      "type": "TrainingAttempt",
      "caption": "Blue jeans",
      "status": "submitted",
      "parentId": "01900000-0000-7000-8000-eacdfcfd0000",
      "rootId": "01900000-0000-7000-8000-a1295a650000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-53c6eea90000",
      "userId": "01900000-0000-7000-8000-e0a63e120000",
      "orgId": "01900000-0000-7000-8000-1971e30a0000",
      "courseKey": "<course key>",
      "questionIds": [
        "01900000-0000-7000-8000-00a700650000"
      ],
      "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-4bce2b100000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer