Library Export Jobs
Get all Library Export Jobs
This endpoint retrieves a list of Library Export Job resources. This endpoint and all of the following are only available when the "Import/Export Version 2 (beta)" feature flag is on.
GET /api/v2/library/export/
Query parameters
The following parameters may be used to filter the Library Export Job resources in the response.
| Parameter | Description |
|---|---|
| ordering | Sort Library Export Jobs by the specified field. Prefix field name with minus to sort descending. Sortable fields: id, status, triggered_by, triggered. |
| status | Given a status, will filter Library Export Jobs by their status. Valid statuses: pending, in_progress, success, fail, cancel. |
| status__in | Given a list of statuses separated by ,s, returns all Library Export Jobs matching specified statuses. |
GET /api/v2/library/export/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"results": [{
"id": 1,
"status": "success",
"triggered": "2025-04-25T14:02:07.815516-04:00",
"triggered_by": {
"id": 1,
"email": "admin@example.com",
"first_name": "Admin",
"last_name": "Testerton"
},
"completed": "2025-04-25T14:02:08.000636-04:00",
"type": "template",
"file_format": "json",
"content_models": ["standard"],
"errors": null,
"can_retry": false
}]
}
Get a specific Library Export Job
This endpoint retrieves a single Library Export Job resource, as specified by the id parameter.
GET /api/v2/library/export/{job_id}/
URL Parameters
| Parameter | Description |
|---|---|
| job_id | The id of the Library Export Job to retrieve |
GET /api/v2/library/export/1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"status": "success",
"triggered": "2025-04-25T14:02:07.815516-04:00",
"triggered_by": {
"id": 1,
"email": "admin@example.com",
"first_name": "Admin",
"last_name": "Testerton"
},
"completed": "2025-04-25T14:02:08.000636-04:00",
"type": "template",
"file_format": "json",
"content_models": ["standard"],
"errors": null,
"can_retry": false
}
Create a Library Export Job
This endpoint creates a new Library Export Job resource and starts the job automatically.
POST /api/v2/library/export/
Payload
| Fields | Required | Description |
|---|---|---|
| type | Yes | The type of export to be done. Options: template, content. |
| file_format | Yes | The file format of the export to be done. Options: csv, json, yaml, xlsx. |
| content_models | Yes | A list of the content models to be exported. Models available: amendment, answer, implementation, question, section, standard, subquestion, subsection, threat, weakness. |
POST /api/v2/library/export/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"type": "content",
"file_format": "json",
"content_models": ["standard"]
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"status": "pending",
"triggered": "2025-04-29T14:46:35.522360-04:00",
"triggered_by": {
"id": 1,
"email": "admin@example.com",
"first_name": "Admin",
"last_name": "Testerton"
},
"completed": null,
"type": "content",
"file_format": "json",
"content_models": ["standard"],
"errors": null,
"can_retry": false
}
Update a Library Export Job
This endpoint updates a specific Library Export Job resource, as specified by the id parameter, allowing it be be cancelled or retried.
PATCH /api/v2/library/export/{job_id}/
URL Parameters
| Parameter | Description |
|---|---|
| job_id | The id of the Library Export Job to update. |
Payload
| Fields | Required | Description |
|---|---|---|
| status | Yes | The status the Library Export Job should be updated to. Valid options: cancel and retry. |
Notes on cancelling jobs:
- Only jobs which are
pendingorin_progressmay be cancelled. - When cancelling a pending job, the status will change immediately to indicate it has been cancelled.
- When cancelling an in progress job, the status of the job will be updated only once the job has successfully terminated in the system. The status in the response will still indicate the job as in progress, so you will need to request the job's details until the job terminates to see the status update.
Notes on retrying jobs:
- Only jobs which have a status of
failorcancelmay be retried. - The triggered time and user will be changed to the user who triggers the
retryoperation. Any errors from the previous run will be clearer out.
PATCH /api/v2/library/export/1/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
{
"status": "cancel"
}
HTTP/1.1 200 OK
Content-Type: application/json
{
"id": 1,
"status": "in_progress",
"triggered": "2025-04-29T14:46:35.522360-04:00",
"triggered_by": {
"id": 1,
"email": "admin@example.com",
"first_name": "Admin",
"last_name": "Testerton"
},
"completed": null,
"type": "content",
"file_format": "json",
"content_models": ["standard"],
"errors": null,
"can_retry": false
}
Get a specific Library Export Job's File
This endpoint retrieves a single Library Export Job's ZIP file, the result of a successful export job execution.
GET /api/v2/library/export/{job_id}/file/
URL Parameters
| Parameter | Description |
|---|---|
| job_id | The id of the Library Export Job to retrieve |
GET /api/v2/library/export/1/file/ HTTP/1.1
Accept: application/zip
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/zip
# Zip files not shown.