Skip to content

Stop a run the server holds

POST
/orgs/{org}/server-runs/{run}/stop
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.

org
required

The organisation id the session was issued for. A token for one organisation can never read another.

string
Example
org_9f3c

The organisation id the session was issued for. A token for one organisation can never read another.

run
required

The run, by id.

string
Example
run_7c2e

The run, by id.

Where the run stands after the stop.

Media typeapplication/json
object
runId
required
string
state
required

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.

string
Allowed values: stopping closed ended
status
required

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.

string
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).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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.

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

No such run in this organisation (code: NOT_FOUND).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
Examplegenerated
{
"error": "example",
"code": "example"
}

The run is not held by the server (code: NOT_A_SERVER_RUN).

Media typeapplication/json

The error envelope every non-2xx answer uses.

object
error
required

Human-readable explanation.

string
code

Machine-readable reason. Absent on a few legacy 400s.

string
key
additional properties
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.

Media typeapplication/json
object
error
required
string
code
required
string
Allowed value: MAINTENANCE
Example
{
"code": "MAINTENANCE"
}
Retry-After
integer

Seconds until asking again is worth it (300 while the switch is on).

Report a problem with this page

sloose.com