Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.
Yuri Schimke edited this page Jul 30, 2016 · 17 revisions

Lyft

Aliases

lyftapi -> https://api.lyft.com{0}

Authentication

Either use an existing granted token, or visit the Developer Dashboard and select an app.

$ oksocial --authorize lyft
Authorising Lyft API
Lyft Client Id: DrXXXXXXX-xxx
Lyft Client Secret:

$ oksocial --authorize lyft --token xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Queries

Export Lyft ride history

$ lyftapi '/v1/rides?start_time=2015-01-01T00:00:00&limit=50' | jq -r '.ride_history[] | [.price.amount / 100, .origin.address, .dropoff.address, .driver.first_name] | @tsv
4.73	from	to	Michael
2.55	from	to	Ruben
0	from	to	Iasmini
2.55	from	to	Derrick
1.55	from	to	Tony
48.94	from	to	Daniel
1.55	from	to	Channon
30.44	from	to	Chaofan
30.22	from	to	Luke
29.11	from	to	Christian
$ lyftapi '/v1/eta?lat=37.80&lng=-122.45'
{
  "eta_estimates": [
    {
      "display_name": "Lyft Line",
      "ride_type": "lyft_line",
      "eta_seconds": 120
    },
    {
      "display_name": "Lyft",
      "ride_type": "lyft",
      "eta_seconds": 120
    },
    {
      "display_name": "Lyft Plus",
      "ride_type": "lyft_plus",
      "eta_seconds": 480
    }
  ]
}

Shell Script

#!/usr/bin/env okshell

var loc = location();

var cost = query("https://api.lyft.com/v1/cost?start_lat=${loc.latitude}&start_lng=${loc.longitude}&end_lat=37.4875929&end_lng=-122.1462192");

cost.cost_estimates.forEach(function(estimate) {
	print(estimate.display_name + " (+" + estimate.primetime_percentage + ") cost " + estimate.estimated_cost_cents_min);
});

Output - blank because of approval process

$ ~/eta.sh
Lyft Plus (+0%) cost 855
Lyft Line (+0%) cost 499
Lyft (+0%) cost 655
Clone this wiki locally