ride-my-way-API
ride-my-way-API is a simple API built for carpooling service, it allows users to signup/login for the service, also it gives users ability to create a ride offers and also make some simple decisions on their ride offer’s requests.
Resource Group ¶
User SignUp ¶
Create a new account for userPOST/auth/signup
you can create a new account with this action. This action takes a JSON payload as the request body. Response then return the new user’s id and a Bearer authorization token. The Bearer token is very important as to some actions require it as an header to get access to data.
Example URI
Headers
Content-Type: application/json
Body
{
"firstname": "Andela",
"lastname": "Bootcamp",
"dob": "25/05/1992",
"gender": "Male",
"picture": "",
"email": "bitbucket06@github.com",
"password": "Password34",
"vehicleType": "Toyota Carolla",
"vehicleModel": "2018",
"driverLn": "DFBHS34GHV34",
"VRN": "43G-DB5"
}
200
Headers
Content-Type: application/json
Body
{
"id": 2,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiZW1haWwiOiJiaXRidWNrZXQwNkBnaXRodWIuY29tIiwiaWF0IjoxNTMzNzcxNTIwLCJleHAiOjE1MzM4NTc5MjB9.j5dF_YMZh4ClEZZWs94m29YiC4dgzuGUID75XFvMc9M"
}
User Login ¶
User authenication for loginPOST/auth/login
This action is use for authenicating existing users. This action takes a JSON payload as the request body. Response then return the new user’s id and a Bearer authorization token. The Bearer token is very important as to some actions require it as an header to get access to data.
Example URI
Headers
Content-Type: application/json
Body
{
"email": "bitbucket05@github.com",
"password": "Password34"
}
200
Headers
Content-Type: application/json
Body
{
"id": 1,
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTMzOTQ1OTY5LCJleHAiOjE1MzQwMzIzNjl9.sglllyxKbQKViKWvzPJmi4zcigksjRIQgopBZ2IfGlQ"
}
User Collection ¶
Get a user detailGET/users/{user_Id}
This action get the detail of a user for the purpose of user profile and etc. You need a token to use this action.
Example URI
- user_Id
number
(required)ID of the user in form of an integer
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTMzOTQ1OTY5LCJleHAiOjE1MzQwMzIzNjl9.sglllyxKbQKViKWvzPJmi4zcigksjRIQgopBZ2IfGlQ
200
Headers
Content-Type: application/json
Body
{
"user_first_name": "Andela",
"user_last_name": "Bootcamp",
"user_dob": "25/05/1992",
"user_gender": "Male",
"user_picture": "",
"user_email": "bitbucket05@github.com",
"user_password": "$2b$10$CkbGCFIUSoD.0/l1RCvBeuFEvNIA7Fpl0Wsmx3GI8nL1MF4O774b2",
"user_vehicle_type": "Toyota Carolla",
"user_vehicle_model": "2018",
"user_dr_ln": "DFBHS34GHV34 ",
"user_vrn": "43G-DB5 ",
"id": 1
}
Deactivate user account ¶
Delete a user accountDELETE/users/{user_Id}
This action remove user’s data permanently from our service’s database as per user’s wish to deactivate the account. You need a token to use this action.
Example URI
- user_Id
number
(required)ID of the user in form of an integer
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
200
Headers
Content-Type: application/json
Body
{
"message": "operation successful"
}
Ride Offers Collection ¶
Get all ride offersGET/rides
This action get a list of all ride offers in our service’s database providing you with various of ride offers.
Example URI
200
Headers
Content-Type: application/json
Body
[
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "8 ",
"ride_seat": 4,
"ride_id": 1
},
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "1 ",
"ride_seat": 4,
"ride_id": 2
}
]
Ride Offer ¶
Get a ride offer detailGET/rides/{ride_Id}
This action get all detail on the a single ride offer. You need a token to use this action.
Example URI
- ride_Id
number
(required)ID of the ride offer in form of an integer
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0Mzc0NDY4LCJleHAiOjE1MzQ0NjA4Njh9.IQLu5QZKrxtRzmfSy6PYmJfeyjFtG_s8nOKkah3qn94
200
Headers
Content-Type: application/json
Body
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "8 ",
"ride_seat": 4,
"ride_id": 1
}
Add ride offer ¶
create a new ride offerPOST/users/rides
you can create a new ride offer with this action. This action takes a JSON payload as the request body. Response then return an integer (1). You need a token to use this action.
Example URI
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0Mzc0NDY4LCJleHAiOjE1MzQ0NjA4Njh9.IQLu5QZKrxtRzmfSy6PYmJfeyjFtG_s8nOKkah3qn94
Body
{
"location": "Ajah",
"destination": "Lekki",
"date": "23/04/2019",
"time": "15:00",
"prize": "5600",
"creator_id": "8",
"seat": 4
}
200
Headers
Content-Type: application/json
Body
1
Add ride offer's request ¶
create a new request for a ride offerPOST/rides/{ride_Id}/request
This action is use to show interest in a ride offer by adding a request to the ride offer. Response then return an integer (1). You need a token to use this action.
Example URI
- ride_Id
number
(required)ID of the ride offer in form of an integer
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Body
{
"passenger_id": "4"
}
200
Headers
Content-Type: application/json
Body
1
Ride Offer Request Collection ¶
get all requests of a single ride offerGET/users/rides/{ride_Id}/request
This action get a list of all request for a single ride offer. You need a token to use this action.
Example URI
- ride_Id
number
(required)ID of the ride offer in form of an integer
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
200
Headers
Content-Type: application/json
Body
[
{
"ride_id": 1,
"passenger_id": 4,
"req_status": "pending ",
"req_id": 1
}
]
Ride Offer Request Decision ¶
update the status of a single ride offer requestPUT/users/rides/{ride_Id}/requests/{request_Id}
This action is use to update the request status on the event of acception or rejection of request from by the ride offer’s creator. You need a token to use this action.
Example URI
- ride_Id
number
(required)ID of the ride offer in form of an integer.
- request_Id
number
(required)ID of the ride offer’s request in form of an integer.
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Body
{
"request_option": "Accept"
}
200
Headers
Content-Type: application/json
Body
1
Ride Offer Search ¶
search for ride offersPOST/search
This action is use to search for ride offers with location and destination.
Example URI
Headers
Content-Type: application/json
Body
{
"destination": "Lekki",
"location": "Ajah"
}
200
Headers
Content-Type: application/json
Body
{
"search_result": [
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "8 ",
"ride_seat": 4,
"ride_id": 1
},
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "1 ",
"ride_seat": 4,
"ride_id": 2
}
],
"related_result": [
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "8 ",
"ride_seat": 4,
"ride_id": 1
},
{
"ride_location": "Ajah ",
"ride_destination": "Lekki ",
"ride_date": "23/04/2019 ",
"ride_time": "15:00 ",
"ride_prize": "5600 ",
"ride_owner_id": "1 ",
"ride_seat": 4,
"ride_id": 2
}
]
}
Delete Ride Offer ¶
Delete a single ride offerDELETE/rides/{ride_Id}
This action is use to delete ride offer in case it is no longer valid (expired) or mistake in detail. Response then returns an integer (1). You need a token to use this action.
Example URI
- ride_Id
number
(required)ID of the ride offer in form of an integer.
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
200
Headers
Content-Type: application/json
Body
1