Demand

Make ride demands, get all available demands, get demands by a specific passenger, update demands, delete demands.

User demand endpoint

get demands

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

Return all demands on a specific offer.

Path Parameters

Name
Type
Description

Authorization

string

The auth_token of the currently authenticated user

Query Parameters

Name
Type
Description

id

integer

Get a demand on a specific offer.

[
  {
    "id": 1,
    "passenger": {
      "first_name": "vick",
      "last_name": null,
      "phone_number": null,
      "profile_pic": "https://carpoolingbackend.herokuapp.com/media/sample.jpg",
      "user": 1
    },
    "origin": {
      "id": 1,
      "name": "Juja",
      "lat": 43.0,
      "lng": 56.0
    },
    "destination": {
      "id": 2,
      "name": "Dellview",
      "lat": 43.0,
      "lng": 56.0
    },
    "available_seats": 1,
    "departure_time": "2020-05-05T02:24:19.008021+03:00",
    "created_at": "2020-01-14T10:02:47.535964+03:00",
    "distance": "30"
  }
]

If No demand has been made yet, the GET request returns an empty array. ( [ ] ).

An example of a get request on the demand endpoint.

get demand endpoint

post demand

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

Make a demand on a specific offer

Path Parameters

Name
Type
Description

Authorization

string

the auth_token of the user making the request.

Request Body

Name
Type
Description

available_seats

integer

The number of seats a passenger needs for the ride.

departure_time

string

The time of departure for the trip.

distance

number

The distance from the origin to the destination in Km.

origin

object

An object containing the longitude, latitude and the name of the passengers current location.

destination

object

An object containing the longitude, latitude and name of the user's chosen destination.

{
  "id": 1,
  "passenger": {
    "first_name": "vick",
    "last_name": null,
    "phone_number": null,
    "profile_pic": "https://carpoolingbackend.herokuapp.com/media/sample.jpg",
    "user": 1
  },
  "origin": {
    "id": 1,
    "name": "Juja",
    "lat": 43.0,
    "lng": 56.0
  },
  "destination": {
    "id": 2,
    "name": "Dellview",
    "lat": 43.0,
    "lng": 56.0
  },
  "available_seats": 1,
  "departure_time": "2020-05-05T02:24:19.008021+03:00",
  "created_at": "2020-01-14T10:02:47.535964+03:00",
  "distance": "30"
}
{
	"origin":{
      "name": "Juja",
      "lng": 56.0,
      "lat": 43.0
	},
	"destination":
	{
      "name": "Dellview",
      "lng": 56.0,
      "lat": 43.0
	},
	"available_seats":1,
	"departure_time":"2020-05-05T02:24:19.008021+03:00",
	"distance":30
}

An example of a post request on the demand endpoint

post_on_demand

delete demand

DELETE https://carpoolingbackend.herokuapp.com/v1/apis/demand/{id}

Delete a demand on a trip.

Path Parameters

Name
Type
Description

Authorization

string

The auth_token of the currently logged in user.

Query Parameters

Name
Type
Description

id

integer

The id of the demand to be deleted.

no body returned for response

Last updated

Was this helpful?