Kubwimana Adrien
Kubwimana Adrien

Reputation: 2531

Is there a way to get a currently accepted Lyft ride request info along with passenger info?

I am trying to display a passenger's name every time a driver accepts a ride request. Is this possible? I couldn't find anything about this in the api documentation. Note: I will only have the driver authenticated.

Upvotes: 2

Views: 254

Answers (1)

theonetheycallneo
theonetheycallneo

Reputation: 118

Yes you can get the passenger's name by calling the GET /v1/profile endpoint.

curl -X GET -H "Authorization: Bearer <access_token>" \
 'https://api.lyft.com/v1/profile'

{
    "id": "123456789",
    "first_name": "Rick",
    "last_name": "Sanchez",
    "has_taken_a_ride": true
}

Online reference: https://developer.lyft.com/v1/reference

The passenger's name is also available on the ride request itself:

curl -X POST -H "Authorization: Bearer <access_token> " \
 -H "Content-Type: application/json" \
 -d '{"ride_type" : "lyft", "origin" : {"lat" : 37.77663, "lng" : -122.39227 },  "destination" : {"lat" : 37.771, "lng" : -122.39123, "address" : "Mission Bay Boulevard North" } }' \
 'https://api.lyft.com/v1/rides'

passenger.first_name
passenger.last_name

Online reference: https://developer.lyft.com/v1/reference#ride-request

Upvotes: 1

Related Questions