diff --git a/User-Login-API.md b/User-Login-API.md new file mode 100644 index 0000000..537078f --- /dev/null +++ b/User-Login-API.md @@ -0,0 +1,60 @@ +# User Login API + +_Last Updated 2017-04-22_ + +## `POST /api/login` + +Takes a `application/json` payload. + +### Request JSON + +``` +{ + email : , + password : +} +``` + +### Response JSON + +#### Success + +Response code of `200 OK` + +``` +{ + success : true, + 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 : +} +``` + +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' +} +``` \ No newline at end of file