jawbone

In the Jawbone UP API, is there any way to get daily step counts between a specified date range?


Reposting from the old UP API forum:

I have a requirement to get the daily step count of the user within specified date ranges. Like for a particular user between the dates 1st june 2016 to 5th June 2016 , I want the step count on each day. Based on what I have read the step count is part of the moves data which can be fetched for a day , but I didn't see any option to extract this data over a date range.


Solution

  • You can use the moves endpoint to get a user's daily step counts over a date range. To do this, you should pass the start_time and end_time parameters with your request:

    Epoch timestamp parameters

    In the data returned, there is a list called items, and each item in this list has a date and a dictionary of details. Within details, the total step count for the day is called steps.

    Here's a Python code snippet (oauth is a requests_oauthlib.OAuth2Session object:

    >>> r = oauth.get('https://jawbone.com/nudge/api/v.1.1/users/@me/moves?start_time=1464739200&end_time=1465084800')
    
    >>> rj = r.json()
    
    >>> [(day['date'], day['details']['steps']) for day in rj['data']['items']]
    [(20160531, 9643), (20160601, 8685), (20160602, 6888), (20160603, 6711)]