Back to top

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 user
POST/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

POST https://rmyway.herokuapp.com/api/v1/auth/signup
Request
HideShow
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"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 2,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MiwiZW1haWwiOiJiaXRidWNrZXQwNkBnaXRodWIuY29tIiwiaWF0IjoxNTMzNzcxNTIwLCJleHAiOjE1MzM4NTc5MjB9.j5dF_YMZh4ClEZZWs94m29YiC4dgzuGUID75XFvMc9M"
}

User Login

User authenication for login
POST/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

POST https://rmyway.herokuapp.com/api/v1/auth/login
Request
HideShow
Headers
Content-Type: application/json
Body
{
  "email": "bitbucket05@github.com",
  "password": "Password34"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "id": 1,
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTMzOTQ1OTY5LCJleHAiOjE1MzQwMzIzNjl9.sglllyxKbQKViKWvzPJmi4zcigksjRIQgopBZ2IfGlQ"
}

User Collection

Get a user detail
GET/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

GET https://rmyway.herokuapp.com/api/v1/users/user_Id
URI Parameters
HideShow
user_Id
number (required) 

ID of the user in form of an integer

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTMzOTQ1OTY5LCJleHAiOjE1MzQwMzIzNjl9.sglllyxKbQKViKWvzPJmi4zcigksjRIQgopBZ2IfGlQ
Response  200
HideShow
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 account
DELETE/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

DELETE https://rmyway.herokuapp.com/api/v1/users/user_Id
URI Parameters
HideShow
user_Id
number (required) 

ID of the user in form of an integer

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Response  200
HideShow
Headers
Content-Type: application/json
Body
{
  "message": "operation successful"
}

Ride Offers Collection

Get all ride offers
GET/rides

This action get a list of all ride offers in our service’s database providing you with various of ride offers.

Example URI

GET https://rmyway.herokuapp.com/api/v1/rides
Response  200
HideShow
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 detail
GET/rides/{ride_Id}

This action get all detail on the a single ride offer. You need a token to use this action.

Example URI

GET https://rmyway.herokuapp.com/api/v1/rides/ride_Id
URI Parameters
HideShow
ride_Id
number (required) 

ID of the ride offer in form of an integer

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0Mzc0NDY4LCJleHAiOjE1MzQ0NjA4Njh9.IQLu5QZKrxtRzmfSy6PYmJfeyjFtG_s8nOKkah3qn94
Response  200
HideShow
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 offer
POST/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

POST https://rmyway.herokuapp.com/api/v1/users/rides
Request
HideShow
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
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
1

Add ride offer's request

create a new request for a ride offer
POST/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

POST https://rmyway.herokuapp.com/api/v1/rides/ride_Id/request
URI Parameters
HideShow
ride_Id
number (required) 

ID of the ride offer in form of an integer

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Body
{
  "passenger_id": "4"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
1

Ride Offer Request Collection

get all requests of a single ride offer
GET/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

GET https://rmyway.herokuapp.com/api/v1/users/rides/ride_Id/request
URI Parameters
HideShow
ride_Id
number (required) 

ID of the ride offer in form of an integer

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Response  200
HideShow
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 request
PUT/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

PUT https://rmyway.herokuapp.com/api/v1/users/rides/ride_Id/requests/request_Id
URI Parameters
HideShow
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.

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Body
{
  "request_option": "Accept"
}
Response  200
HideShow
Headers
Content-Type: application/json
Body
1

Delete Ride Offer

Delete a single ride offer
DELETE/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

DELETE https://rmyway.herokuapp.com/api/v1/rides/ride_Id
URI Parameters
HideShow
ride_Id
number (required) 

ID of the ride offer in form of an integer.

Request
HideShow
Headers
Content-Type: application/json
Authorization: bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6MSwiZW1haWwiOiJiaXRidWNrZXQwNUBnaXRodWIuY29tIiwiaWF0IjoxNTM0OTMxNjI2LCJleHAiOjE1MzUwMTgwMjZ9.KeGb8aFJcBcRvq3G0S0HNMPi8N8HIj7rwkXkzmHqZ3o
Response  200
HideShow
Headers
Content-Type: application/json
Body
1

Generated by aglio on 09 Mar 2023