Login User
- Path:
/user/login
- Type:
POST
Schemas
Request
{ "type": "object", "properties": { "credentials": { "type": "object", "properties": { "email": { "type": "string" }, "password": { "type": "string", "minLenght": 32, "maxLength": 32 } }, "required": [ "email", "password" ], "additionalProperties": false }, "device": { "type": "object", "properties": { "uid": { "type": "string" }, "name": { "type": "string" }, "fiid": { "type": "string" } }, "required": [ "uid", "name", "fiid" ], "additionalProperties": false } }, "required": [ "credentials", "device" ], "additionalProperties": false }
Response
{ "properties": { "status": { "properties": { "code": { "description": "The status code, check the Status Code Enums", "type": "string" }, "message": { "type": "string" } }, "required": [ "code" ], "additionalProperties": false, "type": "object" }, "token": { "description": "The assigned token for this user, this token can be used later to get more detailed info from this user", "type": "string" }, "user": { "properties": { "address": { "type": "string" }, "createdAt": { "description": "The date this user was created at", "type": "string" }, "email": { "type": "string" }, "id": { "type": "number", "multipleOf": 1 }, "lastname": { "type": "string" }, "name": { "type": "string" }, "phone": { "type": "string" } }, "required": [ "name", "lastname", "phone", "address", "email", "createdAt" ], "additionalProperties": false, "type": "object" } }, "required": [ "status" ], "additionalProperties": false, "type": "object" }
Rules
Request
A request to this service should look like the following
{ "credentials": { "username": "test", "password": "encrypted_password" }, "device": { "uid": "1986bba1-dc0e-4ab4-a9cc-1bcc4f6e8d49", "name": "Motorola MotoG3", "fiid": "fISarc9RaDU:APA91bH3kL7fCQ-8HIChn-IjHQH2iR2VrHIKOinHchvtdebZJcZz2lScXPWJ7fX7J4qy7EFdLT_U1nUdsRY162PzRfEq2XtTH9yctygC5Nlt8gtYf9djO4mJpYwqKimL_DhWmu7k3S02" } }
Responses
Successful
If a user is found with the provided email and password, this should be notified to the client with the status code success along with the user data and its assigned token for the provided device
{ "status": { "code": "success", "message": "Dodo el que lo lea" }, "user": { "name": "Dodo", "lastname": "Nido", "phone": "01 800 3636 5621", "address": "Bulevar José María Morelos 307, Sacramento, 83145 Hermosillo, Son.", "email": "contacto@dodo.com", "createdat": "2016-01-01", }, "token": "ef07188f-61e8-4d53-b9ef-e36d4596bcbf" }
Invalid credentials
If no user is found with the provided email and password, this should be notified to the client with the status code invalid_credentials
{ "status": { "code": "invalid_credentials" } }
Invalid request
If the request had an incorrect format the service should answer back with with an status code invalid_request and details of the error in the status message
{ "status": { "code": "invalid_request", "message": "instance property \"device\" is required" } }
- The field credentials.email should be checked ignoring upper and lower cases