Protocolo con Cliente - fmesteban/7552-app-server-1c2016 GitHub Wiki
Protocolo con Cliente
A continuciacion se describe la API del App Server.
Register
URI: /register
Method: POST
Body:
{ "name" : "nombre", "alias": "alias", "password": "password", "email": "[email protected]", "age": "age", "sex": "sex", "interests": [{"category": "interestCategory": "value": "interest"}], “location”: { “latitude”: 121.45356, “longitude”: 46.51119 }, "photo_profile": "base64photo" }
Responses
- 201: {"token": "token"}
- 400: Malformed request
- 500: User already registered (email already in use)
All responses have no body.
Login
URI: /login
Method: POST
Body:
{"email":"[email protected]", "password":"password"}
Responses
- 201: OK
{ "user": {"name" : "nombre", "alias": "alias", "password": "password", "email": "[email protected]", "age": "age", "sex": "sex", "interests": [{"category": "interestCategory", "value": "interest"}], “location”: { “latitude”: 121.45356, “longitude”: 46.51119 }, "photo_profile": "base64photo"}, "token": "token"}
- 400: Malformed request
- 500: Non-existant User
- 500: Invalid password
UpdateProfile
URI: /updateprofile
Method: POST
Body:
{ "name" : "nombre", "alias": "alias", "email": "[email protected]", "age": "age", "sex": "sex", "interests": [{"category": "interestCategory": "value": "interest"}], “location”: { “latitude”: 121.45356, “longitude”: 46.51119 }, "photo_profile": "base64photo" }
Responses
- 200: Accepted
- 400: Malformed Request
- 500: Non-existant User
All responses have no body.
Get Possible Matches (Suggestions)
URI: /getpossiblematches
Method: POST
Body:
{"email":"[email protected]", "count":"cant of possible matches"}
Responses
201: OK
Body:
{"possibleMatches": [{"user": {"name" : "nombre1", "alias": "alias1", "photo_profile": "base64photo", ...... }}, {"user": {"name" : "nombre2", "alias": "alias2", ...... }}]}
Get Matches
URI: /getmatches
Method: POST
Body:
{"email":"[email protected]"}
Responses
201: OK
Body:
{"matches": [{"user": {"name" : "nombre1", "alias": "alias1", "photo_profile": "base64photo", ...... }}, {"user": {"name" : "nombre2", "alias": "alias2", ...... }}]}
Like & Dislike
URI: /like, /dislike
Method: POST
Body:
{ "emailSrc" : "[email protected]", "emailDst": "[email protected]"}
Responses
201: OK
No body.
Conversation
URI: /getconversation
Method: POST
Body:
{ "emailSrc" : "[email protected]", "emailDst": "[email protected]"}
Responses
201: OK
Body:
{"conversation": { "email" : "[email protected]", "messages": [{ "sendFrom" : "email", "msg": "Hola que tal", "time": "12:58"}, { "sendFrom" : "email", "msg": "Pregunté! Hola que tal!!", "time": "12:59"}] } }
Send Conversation
URI: /sendconversation
Method: POST
Body:
{"conversation": { "emailSrc" : "[email protected]", "emailDst": "[email protected]", "messages": [{ "msg": "Hola que tal1"}, { "msg": "Hola que tal2"}, { "msg": "Hola que tal3"} ] } }
Responses
201: OK
No body.
Check Token
URI: /checktoken
Method: POST
Body:
{"email": "[email protected]", "token": "mi token"}
Responses
201: OK
412: Out of time token
No body.