Offer

Make ride offers, get all available offers, get offers by a specific driver, update offers, delete offers.

Get offers endpoint.

get offers

GET https://carpoolingbackend.herokuapp.com/v1/apis/offers

Returns all offers created by a specific driver with the driver profile included.

Path Parameters

Name
Type
Description

Authorization

string

The auth token of the currently logged in user.

[
  {
    "driver": {
      "first_name": "admin",
      "last_name": null,
      "phone_number": null,
      "profile_pic": "http://127.0.0.1:8000/v1/apis/offers/sample.jpg",
      "user": 1
    },
    "origin": {
      "id": 3,
      "name": "Upperhill",
      "lat": 56.0,
      "lng": 43.0
    },
    "destination": {
      "id": 4,
      "name": "Town",
      "lat": 89.0,
      "lng": 32.0
    },
    "seats_needed": 2,
    "departure_time": "02:24:17",
    "created_at": "2020-01-05T02:24:19.008021+03:00",
    "is_full": false,
    "is_ended": false
  }
]

an example of the get offers endpoint on insomnia.

get_offers.png

Create a new offer

post offer

POST https://carpoolingbackend.herokuapp.com/v1/apis/offers

Create a new ride offer.

Path Parameters

Name
Type
Description

Authorization

string

The auth token of the currently logged in user

Request Body

Name
Type
Description

origin

object

The name, longitude and latitude of the users current location.

destination

object

the name, longitude and latitude of the users destination.

seats_needed

integer

the number of seats available

departure_time

string

the time of departure for the driver.

is_full

boolean

A boolean that checks if the seats_needed is equal to the demands on a trip.

is_ended

boolean

A boolean that checks the trip status.

{
  "driver": {
    "first_name": "vick",
    "last_name": null,
    "phone_number": null,
    "profile_pic": "http://127.0.0.1:8000/v1/apis/offers/sample.jpg",
    "user": 2
  },
  "origin": {
    "id": 3,
    "name": "Upperhill",
    "lat": 43.0,
    "lng": 56.0
  },
  "destination": {
    "id": 4,
    "name": "Kitusuri",
    "lat": 43.0,
    "lng": 56.0
  },
  "seats_needed": 1,
  "departure_time": "03:30:30",
  "created_at": "2020-01-07T12:25:08.046276+03:00",
  "is_full": false,
  "is_ended": false
}

Note: When creating offers, the locations origin and destination must be passed as objects.

	"origin":{
      "name": "Upperhill",
      "lng": 56.0,
      "lat": 43.0
	},
	"destination":{
      "name": "Kitusuri",
      "lng": 56.0,
      "lat": 43.0
},

An example of a post request on insomnia.

create_offer

Read

Last updated

Was this helpful?