Skip to content
Paul Maminov edited this page May 1, 2016 · 5 revisions

Though it is only a name. It is not stateless as it uses cookies to manage sessions.

/api/user

GET /

GET http://tekhno-bomberman.tk/api/user/ will render json array of all existing users.

GET /top10

GET http://tekhno-bomberman.tk/api/user/top10 will return json array of Top10 users.

GET /

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 /

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 /

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 /

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 /

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.

/api/sessions

Authorization cookie name is BOMBERMAN-SESSION-TOKEN.

GET /

GET http://tekhno-bomberman.tk/api/session/ will return id of current user if you are logged in or {} if not.

PUT /

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 /

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.

Clone this wiki locally