Response Codes

HTTP Status Codes

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

  • 200
    OK

    It worked!

  • 201
    Created

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

  • 204
    No Content

    The server has fulfilled the request but does not need to return an entity-body. The reasons could be deleting of a resource.

  • 400
    Bad Request

    The request could not be understood by the server. Reason is specified in the response body. (see below for the error format)

  • 401
    Unauthorized

    Client is not authenticated to access this resource.

  • 403
    Forbidden

    Client may be authenticated but does not have the permission to access the resource. The reasons could be invalid/missing API key, invalid/missing OAuth credentials, or missing permissions to access a 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.

  • 500
    Internal Server Error

    The request could not be processed due to an error on the server side. Feel free to contact in case this happens.

  • 503
    Service Unavailable

    The requested service is currently unavailable (due to maintenance or high load).

Error Messages

When the Toornament API detects a bad request, it returns error messages. Here's an example of an error:

{
    "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

    Error message.

  • scope
    string

    The scope refers to an error in a part of the HTTP request. It can be located in the query string or in the message body data.

    Allowed values: query, body

  • property_path
    string

    Optional

    Path of the error from your data which caused the error.

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

  • invalid_value
    string

    Optional

    This property is only available when the property "property_path" is itself available. Identify the incorrect value causing the error.

  • type
    string

    Optional

    Some data cannot be pre-validated by a client i.e. duplicate email participant. You can get the possible list for each endpoint.

    Allowed values: email_duplicate, match_integrity, …