Stop a run the server holds
const url = 'https://api.sloose.com/orgs/org_9f3c/server-runs/run_7c2e/stop';const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
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/server-runs/run_7c2e/stop \ --header 'Authorization: Bearer <token>'Stops a run that the server itself is running (not one a page is running). Needs a signed-in session of someone who may stop this run: an owner or administrator, the person who started it while they are still a member, or anyone who may act on the import it runs. An API token is refused SESSION_REQUIRED and a staff member’s view of the organisation IMPERSONATION_REFUSED. The run is closed cancelled, except that a stop which arrives when every remaining row was already begun refuses nothing and the run completes (state: stopping is not a promise of cancelled). Safe to repeat: it answers where the run stands (state), and a run that has already ended is 200 ended, not an error. Rows already begun finish their later modules and no new row is started; if they have not finished within two minutes the run is taken at once. A run that is not the server’s is 409 NOT_A_SERVER_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 run, by id.
Example
run_7c2eThe run, by id.
Responses
Section titled “Responses”Where the run stands after the stop.
object
stopping: the stop is said and the run is mid-turn; it closes cancelled when the turn comes to it, or COMPLETE where every remaining row was already begun and the stop refused nothing. closed: this call closed it, cancelled. ended: the run was already over, or its result was already decided, so nothing here changed it.
The run’s status as the history holds it when this call answered. It can still read authorised for stopping and for a close not yet written.
Example
{ "state": "stopping"}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 allowed to stop this run (code: NOT_YOURS), the session is a staff view (IMPERSONATION_REFUSED), or the usual refusals of an organisation route; an API token is SESSION_REQUIRED. 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 run in this organisation (code: 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"}The run is not held by the server (code: NOT_A_SERVER_RUN).
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).