API:REST API/Status codes
Appearance
| This page is part of the MediaWiki REST API documentation. |
| MediaWiki REST API |
|---|
|
Documentation
Tutorials See also
|
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]httpCode
required | integer |
Status code |
httpReason
required | string |
Status message |
messageTranslations
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. |
message
optional | string |
In cases where messageTranslations is not available, this property provides an error message in English
|
content_type
optional | string |
In the event of an error due to an unsupported content type, this property indicates the requested content type |
actionModuleErrorCode
optional | string |
Internal error code |