API:REST API/Status codes

From mediawiki.org
Jump to navigation Jump to search

The REST API uses HTTP status codes to indicate the success or failure of a request. A successful request returns a status code in the 200 range; a failed request returns a status code in the 400 or 500 range.

Status codes[edit]

See the API reference for status codes specific to each endpoint.

200 Resource found or updated
201 Resource created
400 Invalid or missing parameter
403 Permission denied
404 Route not found
412 Invalid conditional request
415 Unsupported content type
500 Server error

Error responses[edit]

4xx and 5xx responses include a JSON response object with information about the error. Here's an example of a 404 error response.

  "messageTranslations": {
    "en": "The specified title (...) does not exist"
  "httpCode": 404,
  "httpReason": "Not Found"

Error response schema[edit]


required | integer

Status code

required | string

Status message

optional | object

Object containing error messages as key-value pairs where the key is the language code and the value is the error message. Most endpoints return error messages using this property.

optional | string

In cases where messageTranslations is not available, this property provides an error message in English

optional | string

In the event of an error due to an unsupported content type, this property indicates the requested content type

optional | string

Internal error code