/services/tournaments
{function()}
GET /services/tournaments
Gets tournaments from the database.
GET /services/tournaments?
where[date]=2016-01-01&
sortBy=date
Parameters
-
where
{Object}
OptionalClause used to filter which tournaments are returned
-
sortBy
{String}
OptionalClause used to sort the returned stats
Returns
{JSON}
An object that contains the stats:
{data: [{
id: Int,
date: Date
}, ...]}
POST /services/tournaments
Creates a tournament in the database. Only admins are allowed to create tournaments.
POST /services/tournaments
{
"date": "2016-01-01"
}
Parameters
-
JSONBody
{JSON}
The raw JSON properties of a tournament object
Returns
{JSON}
Returns JSON with all the properties of the newly created object, including its id.
{
"id": 9,
"date": "2016-01-01"
}
GET /services/tournaments/:id
Gets a tournament by id from the database.
GET /services/tournaments/9
Returns
{JSON}
An object that contains the tournament data:
{
id: Int,
date: Date
}
PUT /services/tournaments/:id
Updates a tournament in the database. Only admins are allowed to update tournaments.
PUT /services/tournaments/9
{
"date": "2015-01-01"
}
Parameters
-
JSONBody
{JSON}
The updated properties of the tournament object.
Returns
{JSON}
Returns JSON with all the properties of the updated object, including its id.
{
"id": 9,
"date": "2015-01-01"
}
DELETE /services/tournaments/:id
Deletes a tournament in the database. Only admins are allowed to delete stats.
DELETE /services/tournaments/9
Returns
{JSON}
Returns an empty JSON object.
{}