Response Codes

Status Codes

As the Toornament API is a REST API, it returns appropriate HTTP status codes. Here is a list of the status codes that you can expect from the API:

Success

  • 200
    OK

    It worked!

  • 201
    Created

    The request has been fulfilled and resulted in a created resource.

  • 204
    No Content

    The request has been fulfilled but it does not need to return a response body. This notably occurs when a resource has been deleted.

  • 206
    Partial Content

    The request has been fulfilled and returns a partial result. This may occur when a request implies a range (see pagination).

Client errors

  • 400
    Bad Request

    The request could not be understood by the server. The response body describes the nature of the error (see error messages).

  • 401
    Unauthorized

    The request could not be fulfilled because the client is not authenticated.

  • 403
    Forbidden

    The request could not be fulfilled because, although the client is authenticated, it does not have the permission to access the resource.

  • 404
    Not Found

    The requested resource does not exist. This may be due to a non-existing API endpoint or a non-existing value in the path parameter.

  • 405
    Method Not Allowed

    The request method is not supported by that resource.

  • 416
    Range Not Satisfiable

    The request range cannot be satisfied. This may occur when the requested range is either out of range, invalid, exceeds the size limit or uses an unknown unit.

Server errors

  • 500
    Internal Server Error

    The request could not be processed due to an error on the server side. Feel free to contact our support if you encounter this error.

  • 503
    Service Unavailable

    The requested service is currently unavailable (due to maintenance or high load). Please try again later.

Error Messages

For client errors, additional error messages may be provided to hint the nature of the problem.

Example
{
    "errors": [
        {
            "message": "The value you selected is not a valid choice.",
            "scope": "query",
            "property_path": "with_games",
            "invalid_value": "true",
            "type": "match_integrity"
        }
    ]
}
  • message
    string

    A human-readable message that explains the nature of the problem.

  • scope
    string

    The scope refers to the place in the HTTP request where the error is located.

    Allowed values: query, body, header

  • property_path
    string

    Optional

    A path to the property that issues the error.

    Example: data.list[0].object.property

  • invalid_value
    string

    Optional

    The value that issues the error.

  • type
    string

    Optional

    An error type that can be used for computer-processing.

    Allowed values: email_duplicate, match_integrity, …