OpenFolia

Apply an import

POST
/imports/{importId}/apply

Starts writing a validated import into a new change set (named after it), as you, in a background job: the job checks it again against baseRef as it is then (a report that would now differ fails it: import-outdated), creates the change set, uploads the files (the image and attachment upload path, with its type and size rules), writes the modules and then the manuals as working copies with their locks, and makes save points within CCMS_IMPORT_COMMIT_FILES files and CCMS_IMPORT_COMMIT_BYTES each (at most a save point's 1,000 files and 32 MiB), so a large import becomes several commits on one change set. Every step goes through the change-set actions an editor's would, with their checks. Follow it with GET /imports/:importId (meta.progress); its end is one import.apply audit event with the counts. Takes no body (send Content-Type: application/vnd.api+json), or { "meta": { "skipRefused": true } }: an import whose report refuses items is then applied without them, only when meta.report.applicableWithoutRefused holds (the bundle without them decides every other item as the report does). Exactly the refused items are left out, and nothing else changes; the change set's description and every commit message list them with why, and the job checks again that the rest still stands. Without it, an import with a refused item is refused. Only the import's uploader, within the hour. Needs the admin.roles permission, and content.edit and content.read (each item is checked against your scope as saving it would be).

Authorization

bearer
headerAuthorizationBearer <JWT>

A service account's token (ccms_sat_…, issued by POST /service-accounts/{id}/tokens), or, for local use and demo mode, the server's shared CCMS_API_TOKEN.

Path Parameters

importId*string

The import’s ID (a UUID). One that names no stored import, malformed or not, someone else’s or one removed after it expired, is 404.

Formatuuid

Header Parameters

X-Ccms-User?string

Demo mode only (CCMS_AUTH_MODE=demo): the user ID to act as. The bearer token is still required; without demo mode the header is refused (400).

Request Body

application/vnd.api+json
  1. body
meta?

Response Body

Applying: its job is queued.

application/vnd.api+json
  1. response
data*
Example Request
curl -X POST 'http://localhost:3000/imports/497f6eca-6276-4993-bfeb-53cbbbba6f08/apply' \  -H 'Content-Type: application/vnd.api+json' \  -d '{}'
Example Response
{  "data": {    "type": "Import",    "id": "string",    "attributes": {      "importer": "string",      "options": {        "property1": null,        "property2": null      },      "updateExisting": true,      "baseRef": "string",      "baseCommit": "string",      "fileName": "string",      "size": -9007199254740991,      "state": "dry-run",      "createdBy": {        "kind": "user",        "id": "string"      },      "createdAt": "2019-08-24T14:15:22Z",      "expiresAt": "2019-08-24T14:15:22Z",      "startedAt": "2019-08-24T14:15:22Z",      "finishedAt": "2019-08-24T14:15:22Z"    },    "relationships": {      "changeSet": {        "data": {          "type": "ChangeSet",          "id": "string"        }      }    },    "meta": {      "dryRun": true,      "report": {        "valid": true,        "applicable": true,        "applicableWithoutRefused": true,        "formatVersion": -9007199254740991,        "source": {          "system": "string",          "exportedAt": "string",          "description": "string"        },        "issues": [          {            "severity": "error",            "code": "string",            "message": "string",            "pointer": "string",            "at": "string"          }        ],        "items": [          {            "kind": "module",            "id": "string",            "lang": "string",            "pointer": "string",            "sourceId": "string",            "action": "create",            "reasons": [              {                "severity": "error",                "code": "string",                "message": "string",                "pointer": "string",                "at": "string"              }            ],            "issues": [              {                "severity": "error",                "code": "string",                "message": "string",                "pointer": "string",                "at": "string"              }            ],            "issueCount": -9007199254740991,            "passthrough": -9007199254740991,            "size": -9007199254740991,            "usedAs": "image"          }        ],        "converterReport": [          {            "sourceId": "string",            "sourceKind": "string",            "message": "string",            "module": "string",            "block": "string"          }        ],        "counts": {          "modules": -9007199254740991,          "manuals": -9007199254740991,          "assets": -9007199254740991,          "create": -9007199254740991,          "update": -9007199254740991,          "skip": -9007199254740991,          "refuse": -9007199254740991,          "passthrough": -9007199254740991,          "errors": -9007199254740991,          "warnings": -9007199254740991,          "converterReport": -9007199254740991        }      },      "progress": {        "phase": "queued",        "assets": {          "done": -9007199254740991,          "total": -9007199254740991        },        "files": {          "done": -9007199254740991,          "total": -9007199254740991        },        "commits": [          "string"        ]      },      "failure": {        "code": "string",        "detail": "string"      }    }  }}