Authentication API v2

From Memsource
Jump to: navigation, search

Login

Most of APIs require an authenticated user who is identified by a token. To get a token, call the following API and use the returned value in all subsequent calls. Each token is valid for 24 hours.

action: api/v2/auth/login
    username                    string                             
    password                    string

response: JSON
    {
      "id":30,
      "role":"Admin",                                 // Admin, Linguist, ProjectManager
      "token":"30-a3bf70333f8f1316cb7841cd774c9ce8"
    }

Who Am I

This API call can be used to test if the previous auth/login call went ok. This API does not bring any essential functionality, still it may useful during the development.

action: api/v2/auth/whoAmI
    token                      string

response: JSON
    {
      "username": "alice"
    }

Logout

action: api/v2/auth/logout
    token                      string

response: empty