Report the rows a run failed or passed over
const url = 'https://api.sloose.com/orgs/org_9f3c/imports/imp_4d1a/runs/run_7c2e/outcomes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"outcomes":[{"rowKey":"example","module":"example","outcome":"failed","code":"example","message":"example","recordId":"example","phase":"write","target":"example"}]}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.sloose.com/orgs/org_9f3c/imports/imp_4d1a/runs/run_7c2e/outcomes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "outcomes": [ { "rowKey": "example", "module": "example", "outcome": "failed", "code": "example", "message": "example", "recordId": "example", "phase": "write", "target": "example" } ] }'Every module a row settled in the browser as failed or passed over — a formula that threw, a payload it could not build, an ambiguous match, a write that failed (failed), or a row it skipped, filtered, guarded or left alone (skipped), or — in a dry run — a write it would have made (planned, with CREATE or UPDATE as its code, or UNCHANGED for a match the real run would leave alone because writing it would change nothing) — and every after-save patch that did not fill its field (phase: patch, the field as target) is reported here, up to five hundred at a time, and recorded as attempt 0 beside the attempts the destination answered, so History, the results file and a retry see every failed row after a reload (design §5.4). So is the browser’s word that it made a row’s record after sending the same create and hearing nothing back (made_after_no_answer), which may have made the record too: a flag beside the record’s own answer and never an answer, so the results file and a reopened import still say the record may exist twice when the run’s records do not say the send went unanswered. And so is a dry run’s word that the real run would stop and ask which of several matching records to use (would_ask, with the count as its code, said of the record’s match rather than its write), so a dry run reopened says so as the page that ran it did. A failure is reported even when its write went out, because only the server knows whether it arrived: when it did, the destination’s answer is a later attempt and outranks this one — a row’s outcome is its highest attempt — and when it did not, this is the only record there is. Reporting the same row twice records it once. Only the session or token that authorised the run, while it holds its import — and for two minutes after the runner’s OWN close (complete, cancelled or error), since a leaving page sends its close and its outcomes as independent requests and the close can arrive first. The same two minutes follow the close by which the runner of a run stopped at its row limit says the rows it counted are done (#2142): until then its lease lets it report. Not for a run the server ended on a lease nobody renewed, nor a stopped run its runner never closed, not once the import is gone or being deleted, and not for anyone but the session or token that authorised the run.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The organisation id the session was issued for. A token for one organisation can never read another.
Example
org_9f3cThe organisation id the session was issued for. A token for one organisation can never read another.
The import id.
Example
imp_4d1aThe import id.
The run id, from POST /entitlements/runs/authorise.
Example
run_7c2eThe run id, from POST /entitlements/runs/authorise.
Request Bodyrequired
Section titled “Request Bodyrequired”object
object
failed or skipped, what the browser settled (a skipped outcome coded FILLED on the patch phase is a fill-only patch the run found already filled, where an earlier run had sent it and never heard back: the row’s own answer for it); planned, a dry run’s would-be write; made_after_no_answer, the browser’s word that it made this row’s record in the module after sending the same create and hearing nothing back — so it may exist twice; or would_ask (on the match phase), a dry run’s word that several records matched and the real run would stop and ask which to use, with the count its search found as its code (2, or 10+ when it found as many as it asks for); or lookup (on the lookup phase, the lookup field as target), the browser’s word that a search lookup came to anything but one record — none matched the value in message, blank there was nothing to search by, unworkable its formula could not be worked out, or how many matched it (2, 10+) when the first was linked; or linked (on the lookup phase, the lookup field as target), the browser’s word that a search lookup came to ONE record — recordId the record, message the value searched for, and as its code where the record came from: made by this run, inherited from what an earlier run of this import made, or found by a search. Each word is kept beside the record’s own outcome and never stands for it: they are what a reopen says when nothing else in the run’s records does. Or not_reached (on the stop phase), the browser’s word that the run had begun this row and left it when it stopped, with what stopped it as its code (allowance: a call was refused because the CRM’s API allowance for the day is spent) and the module the row stopped in: the row is not failed and not skipped, a record an earlier module of it made keeps its own outcome, and a resume takes the row again.
On a skipped module passed over because its record already exists (EXISTS, LEFT for a match left as it is, GUARDED for one whose update guard held it back, or UNCHANGED for one left because writing it would change nothing): the record it found and linked to, which the results file names in the module’s record column (#1460). Kept on a planned write with the code UNCHANGED too, a dry run’s prediction of that (#1747). On a linked lookup: the record the lookup linked, which it requires. Ignored on any other outcome, code or phase: a module passed over for any other reason found no record.
Which part of the record this is about: its write (the default), a patch of one field after the save, named by target, its match — which record the write goes to — the one part would_ask is said of, a lookup of one field, named by target, the one part lookup and linked are said of, or the stop that left the row, the one part not_reached is said of.
The field a patch fills or a lookup looks up; required with either, ignored otherwise.
Responses
Section titled “Responses”Recorded.
object
How many were new: a row already reported is not recorded twice.
Examplegenerated
{ "recorded": 1}No outcomes, more than five hundred, one that is not failed, skipped, planned, made_after_no_answer, would_ask, lookup or linked, a patch or a lookup that names no field (code: TARGET_REQUIRED), a planned outcome anywhere but a dry run’s write with CREATE, UPDATE or UNCHANGED as its code (code: NOT_A_PLAN), made_after_no_answer anywhere but the write of a run that writes (code: NOTHING_MADE), or would_ask anywhere but a dry run’s match, or without a count of two or more as its code, or anything but would_ask on a match (code: NOT_A_QUESTION), or lookup anywhere but on a lookup, or with a code that says nothing, or none or a count without the value searched for as its message, or what became of it saying ask in a run that writes or chosen in a dry run, or anything but lookup or linked on a lookup (code: NOT_A_LOOKUP), or linked anywhere but on a lookup, or without the record it linked as its recordId, the value searched for as its message, or made, inherited or found as its code — and made or inherited from a dry run, which makes and inherits nothing (code: NOT_A_LINK).
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 no longer resolves: a session that is unknown or expired (code: AUTH_REQUIRED), or an API token that was revoked or expired (TOKEN_REVOKED, TOKEN_EXPIRED), whose organisation is gone (ORG_NOT_FOUND) or whose member or user row is (MEMBERSHIP_GONE).
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"}Not the session or token that authorised this run (code: NOT_YOUR_RUN), or the role is too low. Like every route behind a session: a session signed in but in no organisation is refused code: NO_ORG, a banned person code: BANNED, and a closed organisation code: ORG_CLOSED.
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 or run, or it is not visible to this session.
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 run no longer holds its import (code: LEASE_LOST).
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 restore switch is on (code: MAINTENANCE): every route but /health and /robots.txt is refused before anything is read, except the operator’s own POST /staff/people/{id}/delete with the ADMIN_TOKEN. Sloose is down for maintenance. Please try again in a few minutes.
object
Example
{ "code": "MAINTENANCE"}Headers
Section titled “Headers”Seconds until asking again is worth it (300 while the switch is on).