OpenFolia

Check an import (a dry run, or stored to apply)

POST
/imports

Runs the importer on the uploaded file, then the import format's validator against the configuration at baseRef (default the server's default branch), the module and manual IDs there and the files already stored that you may read (used at baseRef as you see it, or uploaded into a change set of yours; any other reference not carried in the bundle is missing-asset, whether or not it is stored), and decides each item: create, update (an existing module or manual, only with updateExisting), skip (exists already; a file no written module uses) or refuse (an error, outside your scope, a file the asset rules refuse), with reasons; the report is in meta.report, with the counts, the converter's own report and the passthrough counts. dryRun=true: 200, nothing is stored (no blob, no row, no change set, no Git object). Otherwise 201: the upload and the report are kept for an hour (attributes.expiresAt) so the import can be applied (POST /imports/:importId/apply). Send multipart/form-data (with X-Ccms-Request) with the file in the part file (at most CCMS_IMPORT_MAX_BYTES) and the optional fields importer (default bundle), options (a JSON object, the importer's meta.optionsSchema), updateExisting and dryRun (true or false, default false) and baseRef. A ZIP is read safely: a path leaving its folder, an absolute one, links, the same path twice, more than CCMS_IMPORT_MAX_FILES entries, more than CCMS_IMPORT_MAX_UNPACKED_BYTES unpacked, deeper than CCMS_IMPORT_MAX_PATH_DEPTH folders, encryption, ZIP64 or a file holding more than it declares is 422 invalid-archive (meta.reason). 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.

Header Parameters

X-Ccms-Request?string

Required (any non-empty value) with a body of type multipart/form-data: a cross-site form cannot send it. Not needed with application/vnd.api+json.

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

multipart/form-data
  1. body
file*unknown
importer?string
Default"bundle"
options?string

A JSON object: the importer’s options.

updateExisting?string
Value in"true""false"
dryRun?string
Value in"true""false"
baseRef?string

Response Body

A dry run: the report; nothing stored.

application/vnd.api+json
  1. response
data*
Example Request
curl -X POST 'http://localhost:3000/imports' \  -F 'file=null'
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"      }    }  }}