Acceso a la aplicacion - Taller2Uber/application-server GitHub Wiki

Alta de usuarios

Conductor

Crear una cuenta de usuario de tipo conductor

URL : /api/v1/drivers

Method : POST

Body

{
    "fb_token": "string",
    "user_name": "string",
    "password": "string",
    "firebase_token": "string"

}

Espcificacion de campos

Nombre Tipo Requerido
fb_token string Si
user_name string Si
password string Si`
firebase_token string Si
first_name string No
last_name string No
country string No
email string No
birthday string No

Success Response

Condition : Datos correctos y ningun usuario con esos datos.

Code : 201

Content example

{
    "available": true,
    "first_name": "default",
    "last_name": "default",
    "gender": null,
    "country": "default",
    "firebase_token": "df7Bfmbs_KU:APA91bGIHoBUaFEVJ-HvGav__9D0rODHFwaC-aAfho6Tkbd5Ul83PzcOhc2yQ15-Hmtq12D9bqPBrD-WnxAZ8hxahQaz3UTYIz4DdpBNfjm61z7rrDmA6UKMNNbN3EI2O_jSZO8lZQ1q",
    "fb_id": "",
    "longitude": null,
    "state": "no_route",
    "birthday": "1970-09-09T00:00:00.000Z",
    "actual_route": null,
    "cars": [],
    "latitude": null,
    "_ref": "67515c267b6d43a412d5dae8a789054c412d1f3c",
    "_id": {
        "$oid": "5a26b8a8e69acb000be4178e"
    },
    "user_name": "pedro",
    "email": "default",
    "ss_id": 275
}

Error Responses

Condition : Si ya existe el usuario.

Code : 400

Content example

{
    "error": "Driver already registered"
}

Condition : Error inesperado en la comunicacion con el shared server.

Code : 500

Content example

{
    "error": "Error communicating with Shared-Server"
}

Pasajero

Crear una cuenta de usuario de tipo pasajero.

URL : /api/v1/passengers

Method : POST

Body

{
    "fb_token": "string",
    "user_name": "string",
    "password": "string",
    "firebase_token": "string"

}

Espcificacion de campos

Nombre Tipo Requerido
fb_token string Si
user_name string Si
password string Si`
firebase_token string Si
first_name string No
last_name string No
country string No
email string No
birthday string No

Success Response

Condition : Datos correctos y ningun usuario con esos datos.

Code : 201

Content example

{
    "first_name": "default",
    "last_name": "default",
    "gender": null,
    "firebase_token": "df7Bfmbs_KU:APA91bGIHoBUaFEVJ-HvGav__9D0rODHFwaC-aAfho6Tkbd5Ul83PzcOhc2yQ15-Hmtq12D9bqPBrD-WnxAZ8hxahQaz3UTYIz4DdpBNfjm61z7rrDmA6UKMNNbN3EI2O_jSZO8lZQ1q",
    "fb_id": "",
    "longitude": null,
    "state": "no_route",
    "birthday": "1970-09-09T00:00:00.000Z",
    "actual_route": null,
    "country": "default",
    "latitude": null,
    "_ref": "be97d138c592f91a4f9af864196eee72de839cd8",
    "_id": {
        "$oid": "5a26b7cae69acb000be4178d"
    },
    "user_name": "juan",
    "email": "default",
    "ss_id": 274
}

Error Responses

Condition : Si ya existe el usuario.

Code : 400

Content example

{
    "error": "Passenger already registered"
}

Condition : Error inesperado en la comunicacion con el shared server.

Code : 500

Content example

{
    "error": "Error communicating with Shared-Server"
}

Login

Logueo de usuarios a la app.

URL : /api/v1/users/login

Method : POST

Body

{
    "fb_token": "string"
}

Espcificacion de campos

Nombre Tipo Requerido
fb_token string Si

o

{
    "user_name": "string",
    "password": "string"
}

Espcificacion de campos

Nombre Tipo Requerido
user_name string Si
password string Si

Success Response

Condition : Datos correctos.

Code : 200

Content example

{
    "available": true,
    "first_name": "default",
    "last_name": "default",
    "gender": null,
    "country": "default",
    "firebase_token": "df7Bfmbs_KU:APA91bGIHoBUaFEVJ-HvGav__9D0rODHFwaC-aAfho6Tkbd5Ul83PzcOhc2yQ15-Hmtq12D9bqPBrD-WnxAZ8hxahQaz3UTYIz4DdpBNfjm61z7rrDmA6UKMNNbN3EI2O_jSZO8lZQ1q",
    "fb_id": "",
    "longitude": null,
    "state": "no_route",
    "birthday": "1970-09-09T00:00:00.000Z",
    "actual_route": null,
    "cars": [],
    "latitude": null,
    "_ref": "67515c267b6d43a412d5dae8a789054c412d1f3c",
    "_id": {
        "$oid": "5a26b8a8e69acb000be4178e"
    },
    "user_name": "pedro",
    "email": "default",
    "ss_id": 275
}

Error Responses

Condition : Si no se respeta ninguno de los dos bodies posibles.

Code : 400

Content example

{
    "error": "Bad Request"
}

Condition : Error inesperado en la comunicacion con el shared server.

Code : 500

Content example

{
    "error": "Error communicating with Shared-Server"
}