Library Import Export

Get All Library Export Jobs

This endpoint retrieves a list of Library Export jobs.

Note

The "status" field is readonly and will reflect the state of the export job. It will be one of: "in_progress", "success", "failed"

GET /api/v2/library/jobs/export/


GET /api/v2/library/jobs/export/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [
        {
            "id": 2,
            "triggered_by": "admin@example.com",
            "created": "2020-08-31T10:41:37.026216-04:00",
            "status": "in_progress",
            "file_format": "csv",
            "export_mode": "grouped"
        }
    ]
}

Get All Library Import Jobs

This endpoint retrieves a list of Library Import jobs.

Note

The "status" field is readonly and will reflect the state of the import job. It will be one of: "in_progress", "success", "failed"

GET /api/v2/library/jobs/import/


GET /api/v2/library/jobs/import/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "results": [
        {
            "id": 2,
            "triggered_by": "admin@example.com",
            "created": "2020-08-31T10:41:37.026216-04:00",
            "status": "failed",
            "errors": [
                {
                    "file": "tasks.csv",
                    "row": 2,
                    "field": "amendment_id",
                    "details": "This field must be an integer prexied with CTA"
                },
                {
                    "file": "problems.tsx",
                    "row": null,
                    "field": null,
                    "details": "file type not supported"
                }
            ],
            "filenames": ["tasks.csv", "problems.tsx"]
        }
    ]
}

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/jobs/export/{job_id}/

URL Parameters

Parameter Description
job_id The id of the export to retrieve

GET /api/v2/library/jobs/export/2/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 2,
    "triggered_by": "admin@example.com",
    "created": "2020-08-31T10:41:37.026216-04:00",
    "status": "success",
    "file_format": "csv",
    "export_mode": "grouped"

}

Get a Specific Library Import Job

This endpoint retrieves a single library import job resource, as specified by the id parameter.

GET /api/v2/library/jobs/import/{job_id}/

URL Parameters

Parameter Description
job_id The id of the import to retrieve

GET /api/v2/library/jobs/import/2/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"
HTTP/1.1 200 OK
Content-Type: application/json

{
    "id": 2,
    "triggered_by": "admin@example.com",
    "created": "2020-08-31T10:41:37.026216-04:00",
    "status": "success",
    "errors": [],
    "filenames": ["problems.csv", "tasks.json"]
}

Initiate a Library Export Job

Will add an export job to the queue to be run.

POST /api/v2/library/jobs/export/

Payload

Fields Required Description
file_format Yes Specifies the file format the exported content should be in. Options are "csv", "yaml", "json", "xlsx".
export_mode No Specifies whether to export content items as files grouped by content item type ("grouped") or as individual files ("itemized"). Defaults to "grouped" if not provided

POST /api/v2/library/jobs/export/ HTTP/1.1
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"

{
    "file_format": "csv",
    "export_mode": "itemized"
}
HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "id": 2,
    "triggered_by": "admin@example.com",
    "created": "2020-08-31T10:41:37.026216-04:00",
    "status": "in_progress",
    "file_format": "csv",
    "export_mode": "itemized"
}

Initiate a Library Import Job

Will add an import job to the queue to be run.

POST /api/v2/library/jobs/import/

Payload

Fields Required Description
files Yes The file(s) to be imported into Library.

POST /api/v2/library/jobs/import/ HTTP/1.1
Content-Type: multipart/form-data
Accept: application/json
Authorization: Token "YOUR SDE ACCESS TOKEN"


Content-Disposition: form-data; name="files"; filename="problem.csv"
Content-Type: text/csv
<truncated>
HTTP/1.1 201 CREATED
Content-Type: application/json

{
    "id": 2,
    "triggered_by": "admin@example.com",
    "created": "2020-08-31T10:41:37.026216-04:00",
    "status": "in_progress",
    "errors": [],
    "filenames": ["problems.csv"]
}

Download a Specific Library Export Job's Artifacts

This endpoint retrieves the exported library content from the specified job.

GET /api/v2/library/jobs/export/{job_id}/artifacts/

URL Parameters

Parameter Description
job_id The id of the export to retrieve

GET /api/v2/library/jobs/export/3/artifacts/ 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.

results matching ""

    No results matching ""