Skip to content

sejalgupta3/Trip-Planner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

Trip Planner

The trip planner is a feature that takes a set of locations from the database and will then check against UBER’s price estimates API to suggest the best possible route in terms of costs and duration. UBER Price Estimates Resource used: GET /v1/estimates/price Its using UBER Sandbox environment for all API calls.

##Plan a trip

  • POST /trips
Request
{
    "starting_from_location_id: "999999",
    "location_ids" : [ "10000", "10001", "20004", "30003" ] 
}
Response
{
     "id" : "1122",
     “status” : “planning”,
     "starting_from_location_id: "999999",
     "best_route_location_ids" : [ "30003", "10001", "10000", "20004" ],
  "total_uber_costs" : 125,
  "total_uber_duration" : 640,
  "total_distance" : 25.05 
}

Check the trip details and status

  • GET /trips/{trip_id}
Request:
GET             /trips/1122
Response:
{
     "id" : "1122",
     "status" : "planning",
     "starting_from_location_id: "999999",
     "best_route_location_ids" : [ "30003", "10001", "10000", "20004" ],
  "total_uber_costs" : 125,
  "total_uber_duration" : 640,
  "total_distance" : 25.05 
}

Once a destination is reached, the subsequent call the API will request a car for the next destination.

  • PUT /v1/sandbox/requests/{request_id}
Request:
 /trips/1122/request
{
     "id" : "1122",
     "status" : "requesting",
     "starting_from_location_id”: "999999",
     "next_destination_location_id”: "30003",
     "best_route_location_ids" : [ "30003", "10001", "10000", "20004" ],
  "total_uber_costs" : 125,
  "total_uber_duration" : 640,
  "total_distance" : 25.05,
  "uber_wait_time_eta" : 5 
}

About

Trip Planner

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages