List of available endpoints:
POST /registerPOST /loginGET /tripsPOST /tripsPUT /trips/:idPOST /payment/:id
Request:
- body:
{
"email": "string",
"password": "string",
"firstName": "string",
"lastName": "string",
"isDriver": "boolean",
}Response (201 - Created)
{
"message": "Register successful",
"email": "email@mail.com",
}Response (400 - Bad Request)
[
"Email are required",
"Please enter a valid email address",
"Password are required",
"first name are required",
"last name are required",
]
OR
[
"email must be unique"
]
Request:
- body:
{
"email": "string",
"password": "string"
}Response (200 - OK)
{
"message": "Login successful",
"access_token": "string",
"user_id": 1,
"is_driver": "boolean"
}Response (400 - Bad Request)
{
"message": "Email is required"
}
OR
{
"message": "Password is required"
}Response (401 - Unauthorized)
{
"message": "Invalid email/password"
}
Description:
- Get all trips from database
Request:
- headers:
{
"access_token": "string"
}Response (200 - OK)
[
{
"id": 32,
"UserId": 7,
"DriverId": 7,
"pickupLat": "-6.921152067931175",
"pickupLong": "107.66306753896748",
"pickupLocation": "Mesjid Al-Hikmah, Jln. Sampang No. 1",
"destinationLat": "-6.931961488821898",
"destinationLong": "107.67167736128528",
"destinationLocation": "Kelurahan Cisaranten Endah, Jl. Parakansaat No.150",
"tripStart": null,
"tripEnd": null,
"status": "string",
"redirectUrl": null,
"updatedAt": "2021-11-18T06:29:53.006Z",
"User": {
"firstName": "John",
"lastName": "Doe"
},
"Driver": {
"firstName": "John",
"lastName": "Doe"
}
},
...
]
Description:
- Create trip by id
Request:
- headers:
{
"access_token": "string"
}- params:
{
"pickup": ["-6.921152067931175", "107.66306753896748"],
"pickupLocation": ["-6.931961488821898", "107.67167736128528"],
"destination": "Mesjid Al-Hikmah, Jln. Sampang No. 1",
"destinationLocation": "Kelurahan Cisaranten Endah, Jl. Parakansaat No.150",
}Response (201 - Created)
{
"id": 32,
"UserId": 7,
"DriverId": 7,
"pickupLat": "-6.921152067931175",
"pickupLong": "107.66306753896748",
"pickupLocation": "Mesjid Al-Hikmah, Jln. Sampang No. 1",
"destinationLat": "-6.931961488821898",
"destinationLong": "107.67167736128528",
"destinationLocation": "Kelurahan Cisaranten Endah, Jl. Parakansaat No.150",
"tripStart": null,
"tripEnd": null,
"status": "string",
"redirectUrl": null,
"updatedAt": "2021-11-18T06:29:53.006Z",
"User": {
"firstName": "John",
"lastName": "Doe"
},
"Driver": {
"firstName": "John",
"lastName": "Doe"
}
},
Description:
- Update status by id
Request:
- headers:
{
"access_token": "string"
}- params:
{
"id": "integer (required)",
"status": "string (required)"
}Response (200 - OK)
{
"id": 32,
"UserId": 7,
"DriverId": 7,
"pickupLat": "-6.921152067931175",
"pickupLong": "107.66306753896748",
"pickupLocation": "Mesjid Al-Hikmah, Jln. Sampang No. 1",
"destinationLat": "-6.931961488821898",
"destinationLong": "107.67167736128528",
"destinationLocation": "Kelurahan Cisaranten Endah, Jl. Parakansaat No.150",
"tripStart": null,
"tripEnd": null,
"status": "string",
"redirectUrl": null,
"updatedAt": "2021-11-18T06:29:53.006Z",
"User": {
"firstName": "John",
"lastName": "Doe"
},
"Driver": {
"firstName": "John",
"lastName": "Doe"
}
},Response (403 - Forbidden)
{
"message": "Forbidden: Not Authorized"
}Response (404 - Not Found)
{
"message": "Trip with id {id} not found"
}
Request:
- body:
{
"id_token": "string",
}Response (200 - OK)
{
"message": "Login successful",
"access_token": "string"
}Response (201 - Created)
{
"message": "Login successful",
"access_token": "string",
"user_id": 1,
"user_role": "Staff"
}
Request:
- body:
{
"card_number": "string",
"card_exp_month": "string",
"card_exp_year": "string",
"card_cvv": "string",
"price": "string"
}Response (200 - OK)
{
"message": "Charge successful",
}
Response (401 - Unauthorized)
{
"message": "Not Authorized"
}
OR
{
"message": "Invalid Email or Password"
}Response (500 - Internal Server Error)
{
"message": "Internal server error"
}