CrushMFT Documentation

Errors#

Every error has one shape (RFC 9457), sent as application/problem+json, with a real HTTP status:

{
  "type": "/WebInterface/api/v1/docs#error-forbidden",
  "title": "Forbidden",
  "status": 403,
  "code": "forbidden",
  "detail": "denied: target user holds rights you do not",
  "operation": "users.update",
  "permission": "users.user.edit.account",
  "request_id": "r-8f2c41d09a"
}
Field What
code Stable: what a program switches on. The list is below.
status The HTTP status again.
detail What went wrong, in words, for a person.
operation The operation that answered, when the path named one.
permission For a refusal: the permission that was missing.
errors For validation_failed: every field that fails, with its rule and a message.
request_id The same as the X-Request-Id header; it finds the request in the server log.

A program should switch on code, not on detail or title: those are words and may change.

The codes#

An error (RFC 9457), as application/problem+json. code is stable and is what a program switches on; detail says it in words; request_id finds the request in the server log.

Code Status Meaning
bad_request 400 The request cannot be read: a broken path, an unknown or badly typed parameter, a body that is not a JSON object.
validation_failed 422 The body is well-formed, but one or more of its fields cannot be used. errors lists each field, the rule and a message.
unauthenticated 401 No credential, or one that did not log in.
forbidden 403 Logged in, and refused. detail carries the reason the access engine gave.
tier0 403 The operation is equal to full control of the server. No token may use it, and of the accounts only the Administrator role.
read_only_token 403 The token is read-only and the operation changes something.
legacy_account 403 The account holds legacy admin flags, which the API does not act on. Convert it to roles, or issue a token for it.
not_open_yet 403 The command behind the operation is not switched on for roles and tokens yet. An administrator's own login can use it.
dmz_not_allowed 403 The request came through a DMZ, and the API does not answer those unless api_from_dmz allows it.
edition_required 403 The operation needs an edition this server is not licensed for.
not_found 404 No such operation, no such object, or an object the caller's scope does not cover.
method_not_allowed 405 The path exists and the method does not. Allow lists the methods that do.
conflict 409 The object already exists, or is in a state that does not allow this.
precondition_failed 412 If-Match did not match: the object changed since it was read.
payload_too_large 413 The body is larger than api_max_body_kb.
unsupported_media_type 415 A body must be Content-Type: application/json.
rate_limited 429 Too many requests for this credential or address in this minute. Retry-After says when to try again.
internal_error 500 A fault in the server. The server log has the cause under the request id.
not_implemented 501 The operation is in the registry and is not built on this server yet.
unavailable 503 The server is starting or shutting down.
fips_restricted 409 The server runs in FIPS 140-3 mode (launched with -Dcrushmft.fips=true), and FIPS mode does not allow what was asked: the detail is the catalog row's reason and what to use instead, fips_id its id (CrushFTP design/61 section 5).
Field Type Required Description
type string
title string
code string, one of bad_request, validation_failed, unauthenticated, forbidden, tier0, read_only_token, legacy_account, not_open_yet, dmz_not_allowed, edition_required, not_found, method_not_allowed, conflict, precondition_failed, payload_too_large, unsupported_media_type, rate_limited, internal_error, not_implemented, unavailable, fips_restricted
detail string
operation string
permission string
request_id string
status integer

What to do#

  • 401 unauthenticated: the credential is missing, wrong or expired. Get a new token.
  • 403: forbidden names the permission; ask POST /explain for the reason in full. tier0 and read_only_token mean a token cannot do this at all; legacy_account means the account needs roles or a token.
  • 404 not_found is also the answer for an object outside the caller's scope, so that a scope cannot be mapped by trying names.
  • 409 conflict, 412 precondition_failed: read the object again and decide again.
  • 409 fips_restricted: the server runs in FIPS 140-3 mode, which does not allow what was asked. detail says why and what to use instead, and fips_id names the item of What FIPS mode changes. Asking again will not help; change the request. GET /server/fips lists every item.
  • 422 validation_failed: fix the fields listed in errors.
  • 429 rate_limited: wait the seconds in Retry-After.
  • 503 unavailable: the server is starting or stopping; try again shortly.