3.2 Synchronous Responses Format
Contents:
- 3.2.1 HTTP Status Codes
- 3.2.2 Envelope
- 3.2.3 Rate Limits
3.2.1 HTTP persistent connections
MollyBet API tries to return the appropriate HTTP status codes. These are only intended to be a general hint about the nature of the response being received; more details are contained within the response.Code | Meaning | Description |
---|---|---|
200 | OK | Success! |
400 | Bad request | The request was invalid. It contained badly formatted data, or data that fails validation. For example: a required parameter is missing, or an order is placed with a negative price. |
401 | Unauthorised | Authentication credentials were missing from the request or incorrect. You need to re-authenticate and try again. |
403 | Forbidden | The request has been denied due to the current user not having sufficient permissions to perform the requested action. |
404 | Not found | The requested URI cannot be found on the server. This may refer to the specific URL, or to the resource being identified (e.g. a specific betslip). |
405 | Method not allowed | The given URI does not support this HTTP method (e.g. it supports GET, but you are trying to POST). |
406 | Not acceptable | The response format requested by the Accept HTTP header is not supported by the API. |
415 | Unsupported media type | The request is in a format specified by the Content-Type HTTP header that the API does not support. |
429 | Too many requests | You are being rate limited. |
500 | Internal Server Error | An unexpected error has occurred. |
503 | Service Unavailable | MollyBet API is unavailable or is being restarted. |
3.2.2 Envelope
MollyBet API responses are wrapped in an envelope with a standard set of keys you can examine. A successful response will look like the following:{
"status": "ok",
"data": "... some call-specific data here"
}
The status
field will report ok for successful responses, or error when something has gone wrong. In addition to the status
field, a successful response will always include a data
field with the payload of the response.
Similarly for error responses, apart from the status
field, they always contain a code
field which corresponds to the name of the "exception" being raised. This is a machine- and human-readable string that describes the exact causes of the error encountered.
Furthermore, an error response may optionally contain a data
field with a human-readable message giving more information about the error and how it may be resolved. For example, a 400 response to login could look like this:
{
"status": "error",
"code": "validation_error",
"data": {
"password": [
"This field is required."
]
}
}