1 User Login API
Tom Bloor edited this page 2017-04-22 18:20:02 +01:00

User Login API

Last Updated 2017-04-22

POST /api/login

Takes a application/json payload.

Request JSON

{
  email : <login email>,
  password : <login password>
}

Response JSON

Success

Response code of 200 OK

{
  success : true,
  session_key : <session_key>
}

Failure

If something is missing from the request, or is invalid, you will get a response code of 400 BAD REQUEST and the following:

{
  success : false,
  message : <error message>
  error : <error type>
}

If the username or email was incorrect, you will get a 401 UNAUTHORISED and the following:

{
  success : false,
  message : 'Email or password is invalid',
  error : 'login_fail'
}

If there was a server error, you will get a `500 SERVER ERROR` and possibly the following:

{ success : false, message : 'An unknown error occurred when logging in' error : 'server_error' }