EaserixDocs
DevelopersAPI referenceTasksImports

Say exactly what an import would do

Step 2 of 3. Administrators only. Takes the column mapping and returns the plan: how many rows would be created, skipped (already imported) or refused, which statuses, labels and projects would be created, which people in the file are not members, the problems found, and the first few rows as they would be written. Nothing is written to the team. Can be repeated, and each call replaces the last. `plan.fingerprint` identifies the plan: commit must carry the fingerprint of the most recent preview. A mapping that cannot be used is a 422 listing every problem together. Only an import that has not been started can be previewed (409 otherwise).

View as Markdown
POST
/v1/imports/{id}/preview
AuthorizationBearer <token>

In: header

Path Parameters

id*string
Formatuuid

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/imports/497f6eca-6276-4993-bfeb-53cbbbba6f08/preview" \  -H "Content-Type: application/json" \  -d '{    "mapping": {      "v": 1,      "columns": {        "property1": "string",        "property2": "string"      }    }  }'
{  "import": {    "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",    "teamId": "a4ede8ba-7c0a-4485-8763-cbd9b282fbec",    "source": "csv",    "namespace": "string",    "status": "uploaded",    "fileName": "string",    "fileSize": 0,    "totalRows": 0,    "createdCount": 0,    "skippedCount": 0,    "failedCount": 0,    "cancelRequested": true,    "createdBy": "25a02396-1048-48f9-bf93-102d2fb7895e",    "createdAt": "2019-08-24T14:15:22Z",    "startedAt": "2019-08-24T14:15:22Z",    "finishedAt": "2019-08-24T14:15:22Z",    "retryAfter": "2019-08-24T14:15:22Z",    "undoneAt": "2019-08-24T14:15:22Z",    "batchId": "5579c111-9c50-47e2-af92-f16d52e63189",    "origin": "file",    "undoableUntil": "2019-08-24T14:15:22Z",    "commentCount": 0,    "mapping": {      "v": 1,      "columns": {        "property1": "string",        "property2": "string"      },      "idColumn": "string",      "idAlias": "string",      "people": {        "property1": "string",        "property2": "string"      },      "strict": true,      "sprintDates": {        "property1": {          "start": "2019-08-24",          "end": "2019-08-24"        },        "property2": {          "start": "2019-08-24",          "end": "2019-08-24"        }      },      "linkColumns": [        "string"      ],      "markup": "none",      "commentFormat": "plain",      "completedFallback": "string",      "dateFormat": "iso",      "timezone": "Asia/Kolkata",      "labelSeparator": "str",      "status": {        "property1": {          "stateId": "871bb69c-5872-42b2-88b0-72e9da663aaa",          "create": true,          "type": "backlog"        },        "property2": {          "stateId": "871bb69c-5872-42b2-88b0-72e9da663aaa",          "create": true,          "type": "backlog"        }      },      "priority": {        "property1": 0,        "property2": 0      }    },    "reconciliation": {      "rows": 0,      "created": 0,      "alreadyImported": 0,      "refused": 0,      "notWritten": 0,      "allAccountedFor": true,      "byStatus": [        {          "status": "string",          "inFile": 0,          "created": 0,          "alreadyImported": 0,          "refused": 0,          "notWritten": 0        }      ]    }  },  "plan": {    "identity": "string",    "weakIdentity": true,    "total": 0,    "create": 0,    "skip": 0,    "invalid": 0,    "comments": 0,    "commentsSkip": 0,    "attachments": 0,    "newCycles": [      {        "name": "string",        "rows": 0,        "fromFile": true,        "start": "2019-08-24",        "end": "2019-08-24"      }    ],    "existingCycles": [      {        "name": "string",        "rows": 0      }    ],    "multiSprint": 0,    "links": 0,    "linksSkip": 0,    "commentAuthorsUnmatched": 0,    "errorCount": 0,    "warningCount": 0,    "problems": [      {        "row": 0,        "field": "string",        "code": "string",        "message": "string",        "severity": "error"      }    ],    "problemsTruncated": true,    "newStates": [      {        "name": "string",        "type": "backlog",        "rows": 0      }    ],    "newLabels": [      {        "name": "string",        "rows": 0      }    ],    "newProjects": [      {        "name": "string",        "rows": 0      }    ],    "unresolvedPeople": [      {        "value": "string",        "rows": 0,        "assigneeRows": 0,        "assignedTo": "string"      }    ],    "unresolvedPeopleTotal": 0,    "assigneesMapped": 0,    "unknownPriorities": [      {        "name": "string",        "rows": 0      }    ],    "unknownPrioritiesTotal": 0,    "sample": [      {        "row": 0,        "action": "create",        "sourceId": "string",        "title": "string",        "description": "string",        "state": {          "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08",          "newName": "string",          "newType": "string"        },        "priority": 0,        "labels": [          "string"        ],        "project": "string",        "assigneeResolved": true,        "assigneeText": "string",        "createdAt": "2019-08-24T14:15:22Z",        "completedAt": "2019-08-24T14:15:22Z",        "dueDate": "string",        "estimate": 0,        "parentSourceId": "string"      }    ],    "warnings": [      "string"    ],    "fingerprint": "string"  }}

Get what an unstarted import's file looked like

Administrators only. The same answer `createImport` gave when the file was uploaded, for an import that has not started (`uploaded` or `planned`): the file's headers and first rows, `detected`, and `suggestedMapping`, which is the mapping the import already has when it has one (made by the Linear connector, or saved by a preview) and the suggestion otherwise. It lets a screen review an import it did not upload itself, such as each team of a Linear fetch, or one found again after a reload. An import that has started is a 409 `not_editable`. One in another workspace is a 404.

Start an import

Step 3 of 3. Administrators only. Queues the import, which a background worker then carries out one row after another (poll `getImport`). The body names the preview that was approved by its `fingerprint`. The plan is built again at this moment, and if anything it depends on has changed (a status deleted, a person added, another import finished) the answer is 409 `plan_changed` with the new plan, and nothing runs. The new plan is kept as the latest preview, so after reading it the caller commits with its fingerprint, without previewing again. Refusals: 409 `preview_first` (not previewed, or already started), `stale_preview` (a newer preview exists), `import_in_progress` (one import runs per team at a time), 422 `nothing_to_import`. The person who commits is the creator of any issue whose row names no creator. The action is recorded on the security log.