Skip to content

Responses and errors ​

A success is a JSON object with status: true, a human-readable statusText, and the result in data:

json
{ "status": true, "statusText": "Pages fetched.", "data": [] }

A few routes put a value beside data instead of inside it (a new task's id, a list's hasMore); each route below shows its own response.

A failure is a JSON object with status: false and the reason in statusText, message or both:

json
{ "status": false, "statusText": "Page not found." }

Some failures add error, a machine-readable code, the permission key that was missing, or the field that was refused.

Status codes. The web app expects HTTP 200 on a handled failure and reads status from the body. A request made with an API token gets a real status code instead: when a handler answers 200 with status: false, the server changes the status line to the matching 4xx and adds the header X-Status-Mapped: 1. The body is not changed. Any other caller can ask for the same with the header Prefer: status-codes. The code is the handler's own statusCode when it sets one, and is otherwise read from the text: "not found" is 404, a permission refusal is 403, "already" or "duplicate" is 409, a token or session problem is 401, and anything else is 400. Check status in the body as well as the status code.

StatusMeaning
400The request was refused: a missing or malformed field, an unknown key, a value out of range.
401No token, a token that is invalid, expired or revoked, or no valid companyid header.
403The token lacks the scope, the person's role lacks the permission, or the token may not use the route.
404The thing does not exist, or the caller may not see it. The two are answered alike on purpose.
409The request conflicts with what is stored.
429Rate limited. See Rate limiting.
500The server failed. The body carries status: false.

Released under the AGPL-3.0 licence.