-
Notifications
You must be signed in to change notification settings - Fork 1
REST API
Though it is only a name. It is not stateless as it uses cookies to manage sessions.
GET http://tekhno-bomberman.tk/api/user/
will render json array of all existing users.
GET http://tekhno-bomberman.tk/api/user/top10
will return json array of Top10 users.
GET http://tekhno-bomberman.tk/api/user/10
will return json like
{
id: 8,
login: "login_string",
score: 9999
userpic_path: "static/user8.png"
}
PUT http://tekhno-bomberman.tk/api/user/
will create new user if the following json is sent among:
{
login: "login_string",
password: "password_string"
}
It will return json with new user id and also will autologin user.
{
id: 12
}
POST http://tekhno-bomberman.tk/api/user/
will update current user if the authorization cookie is specified and following json is sent among:
{
login: "login_string",
password: "password_string"
}
POST http://tekhno-bomberman.tk/api/user/
with multipart-data
will bind file named "userpic" to current user's userpic parameter.
It will update password
field and return json with current user id.
{
id: 12
}
DELETE http://tekhno-bomberman.tk/api/user/
will permanently erase all traces of current user if the authorization cookie is specified. It will return {}
regardless of was deletion successful or not.
Authorization cookie name is BOMBERMAN-SESSION-TOKEN
.
GET http://tekhno-bomberman.tk/api/session/
will return id of current user if you are logged in or {}
if not.
PUT http://tekhno-bomberman.tk/api/session/
with a certain json↓ will return id if login was successful or {}
if not.
{
login: "login_string",
password: "password_string"
}
DELETE http://tekhno-bomberman.tk/api/session/
will log user out thus removing authorization cookie. It will return {}
regardless of was deletion successful or not.