Modules API

Base path: /api/modules

Modules (also called longforms) are the content documents produced by the editor. This is the core content workflow: create and save versions, browse history, share, assign, and export.

Authorization, permission filtering, LTI verification, and Google Classroom hand-off all live behind the backend’s repository — the routes only handle HTTP.

  • GET /api/modules — list the modules the requester may see.
    • Query: from, size, include (comma-separated relations), filter[published], filter[featured], organization_id, created_by, and the LTI context lti_platform_id + id_token.
  • GET /api/modules/search — full-text search across accessible modules.
    • Query: q (search terms), from, size, include, lti_platform_id, id_token.

Search is powered directly by PostgreSQL — see System requirements.

Read

  • GET /api/modules/:id — fetch a single module descriptor. Returns null when the module is not visible to the requester.

Save

  • POST /api/modules/:id — save a new version of a module.

    • Body: { "data": Module, "rev": string | null }.
    • rev provides optimistic concurrency: pass the revision you based your edit on. If it is stale, the request fails with 409 Conflict instead of overwriting a newer version.
    • The response echoes the saved content with the new revision id.
  • DELETE /api/modules/:id — soft-delete a module.

Version history

  • GET /api/modules/:id/versions — list past revisions. Query: from, size.
  • GET /api/modules/:id/versions/:version_id — fetch the content of one past version, for rollback or audit.

Sharing

  • GET /api/modules/:id/share — read the module’s sharing options.
  • POST /api/modules/:id/share — update sharing options.

Assignments

Link a module to a learning platform (e.g. Google Classroom — see Google Classroom):

  • GET /api/modules/:id/assignments — list a module’s assignments.
  • POST /api/modules/:id/assignments — create an assignment for the module.

Export

  • GET /api/modules/:id/linked-data — the current version as JSON-LD.
  • GET /api/modules/:id/download — a self-contained offline package (application/zip) bundling the content, its media, and the viewer runtime as a single HTML file. Add ?scorm to include a SCORM 2004 imsmanifest.xml for upload to a SCORM-compatible LMS.