Change a source
const url = 'https://api.sloose.com/orgs/org_9f3c/imports/imp_4d1a/sources/src_7c2e';const options = { method: 'PATCH', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"version":1,"label":"example","options":{"additionalProperty":"example"},"position":1}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request PATCH \ --url https://api.sloose.com/orgs/org_9f3c/imports/imp_4d1a/sources/src_7c2e \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "version": 1, "label": "example", "options": { "additionalProperty": "example" }, "position": 1 }'Rename a source, read it under new options, or move it — under version, in one write with the bump. A change that changes nothing is answered with the source as it stands and moves no version.
New options re-read the stored file, so the columns and the count follow them, and a reading that refuses changes nothing (422 NOTHING_READ). Like a replaced file, a new reading drops the source’s cleaning — its exclusions and edits counted rows of the old reading — and says that no kept AI answer made it (madeByAnswer null): the rows are not the ones an answer left.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The org id the session was issued for. A token for one org can never read another.
Example
org_9f3cThe org id the session was issued for. A token for one org can never read another.
The import id.
Example
imp_4d1aThe import id.
The source id.
Example
src_7c2eThe source id.
Request Bodyrequired
Section titled “Request Bodyrequired”object
The version this change was made against — from the last read or write.
What the source is called. Blank puts back the name its rows arrived under; a name another source has is numbered.
The reader’s options, the keys given replacing the stored ones. Delimited text: delimiter (, \t ; | or a space), quote (" or '), collapse (boolean) — each null to work it out from the file. A workbook: sheet and headerRow, both counted from 0; a new sheet without a headerRow has its header row found. Any other key is refused.
object
Where the source sits among the import’s sources, which are listed by position and then in the order they were added.
Examplegenerated
{ "version": 1, "label": "example", "options": { "additionalProperty": "example" }, "position": 1}Responses
Section titled “Responses”The source as it now stands.
object
object
The connection Target names; null until one is chosen.
The template this import was started from or saved as.
The template version it copied: “the template has moved on” compares this.
Who started it — the person, or the person a token acts as. Null only for an import a schedule started, which is nobody’s own.
The token held, when one was.
Where it stands. An import being deleted is not returned at all: it reads as gone the moment its delete is accepted.
Whichever step the wizard of the day left it on, as that wizard names it.
The write precondition: every change names the version it was made against, and a stale one is refused 409 IMPORT_CHANGED.
The run that holds the import; every other write is refused while one does.
object
Where the rows came from: file, paste, generated, connection.
Which reader read the bytes: delimited or xlsx.
The SHA-256 of the file stored for the source, hex: the identity of its bytes, which changes with every new file and never with a new reading of the same one. With how they are read (reader, options, sheetName), what says an AI answer that proposed a change to the file (a reshape, a sample, a re-read) was not taken: the same bytes, read the same way, are still the file it was proposed for. Null for a file stored before it was kept; the sheets of one workbook share their workbook’s.
Which kept answer made this file — { turnId, index }, the turn and the reshape, sample or re-read in its targets — or null: what says such an answer was used, on the server and in the app alike, where the file’s shape cannot. Written with every file stored for the source and every new reading of it, from the upload’s madeByAnswer, and null for any other.
object
How this file was reshaped from the file as read at its header row (#1363): the steps in order, each counted on the grid the ones before it left, every row a step named by its place marked so another file’s can be found by it. Written with every file stored for the source and every new reading of it, from the upload’s reshape, and null for any other.
object
object
object
One letter a cell: b blank, n a number, t other text.
Its text cells, digits taken out, case and spaces folded, joined by |.
What the reader needs to read the file again: delimiter, sheet, header row — in the shape this build reads, whatever shape they were stored in. They are stored with the version of that shape and walked forward when read; that version is not shown.
The worksheet’s name, for a source read from one; null for text. The reader finds the sheet by its place (options.sheet); a template names it by this, because a name survives next month’s workbook having its tabs reordered.
The size of the current cleaning revision; null when the source has none.
The size of the current revision of its work — the guesses waiting on it, the ones turned down, how each used one was found; null when the source has none.
The recipe flow this source feeds, paired by id and never by label or position.
Example
{ "import": { "status": "open" }, "source": { "reshape": { "steps": [ { "marks": [ { "from": "start" } ] } ] } }}The body did not match the schema, or options named a key the source’s reader does not have (code: INVALID_BODY, with issues).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No bearer, or one that is expired, revoked or no longer resolves to a member.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The bearer’s role is too low, or it was issued for a different org; or somebody else started this import and an operator changes only their own (code: NOT_YOURS).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}No such import (IMPORT_NOT_FOUND) or source (SOURCE_NOT_FOUND); or the file new options would re-read is not in storage (FILE_NOT_FOUND).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}Somebody changed the import since this version was read (code: IMPORT_CHANGED, with the version it is at now and updatedBy); a run holds it (code: IMPORT_RUNNING, with the runId); this deployment has no storage for imports yet (code: NOT_CONFIGURED); or a source’s reader options were written by a newer build of Sloose than this one (code: FROM_FUTURE, which is refused before anything is written). Or the stored file is a workbook whose XML unpacks to more than the server reads whole (code: WORKBOOK_TOO_LARGE, with unpacked and limit in bytes).
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}The source has no stored file to read under options (code: NO_FILE), or the file will not read under them (code: NOTHING_READ) — a sheet that is not there, a header row with nothing in it, a row of more than 1,048,576 characters in its cells or more than 16,384 cells.
The error envelope every non-2xx answer uses.
object
Human-readable explanation.
Machine-readable reason. Absent on a few legacy 400s.
Examplegenerated
{ "error": "example", "code": "example"}