Skip to content

Instantly share code, notes, and snippets.

Created December 4, 2014 19:52

Revisions

  1. @invalid-email-address Anonymous created this gist Dec 4, 2014.
    26 changes: 26 additions & 0 deletions gistfile1.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,26 @@
    With [Basic Auth][basic], who are your [co-workers][people]:

    $ curl -H 'Authorization: Basic …' -H 'Accept: application/json' https://example.harvestapp.com/people
    > jq 'map(select(.user.is_active)) | map(.user | {first_name: .first_name, last_name: .last_name, id: .id})'
    [
    {
    "id": 1234,
    "last_name": "Alice",
    "first_name": "Bobsdaughter"
    },
    {
    "id": 2345,
    "last_name": "Charlie",
    "first_name": "Danielson"
    }
    ]

    What's their [running timer][running] (if they have one)? Look at Alice:

    $ curl -H 'Authorization: Basic …' -H 'Accept: application/json' 'https://example.harvestapp.com/daily?of_user=1234' |
    > jq '.day_entries | map(select(.timer_started_at)) | .[].notes'
    "Working in a coal mine, going down, down..."

    [basic]: https://github.com/harvesthq/api/blob/master/Authentication/HTTP%20Basic.md
    [people]: https://github.com/harvesthq/api/blob/master/Sections/People.md
    [running]: https://github.com/harvesthq/api/blob/master/Sections/Time%20Tracking.md#retrieving-entries-and-projectstasks-for-a-day