xAPI statements API
Base path: /api/statements
Ingests xAPI (Experience API) statements — the learning records emitted when a learner interacts with exercises and assignments. The route resolves the referenced content and assignment and hands the statement to the statements repository for persistence.
Endpoint
POST /api/statements/:ref_id/:assignment_id?— record one xAPI statement.- Path:
ref_id(required) — the content reference the statement is about;assignment_id(optional) — the assignment the statement belongs to. - Body: a standard xAPI statement (
actor,verb,object, and optionalcontext/result), sent as JSON.verb.idis required, andtimestampmust be an ISO 8601 datetime carrying a timezone — eitherZor a±hh:mmoffset, which is whatDate.prototype.toISOString()produces. - Response:
200 OKwith{ "ok": true }on success.
- Path:
Errors
400 Bad Request— missingref_id, or a body that is not a valid statement (missingverb.id, atimestampwithout a timezone, and so on). The response body carries amessagenaming the offending field.404 Not Found— theref_id(or the givenassignment_id) does not exist.