Can I request months of data with Terra

DreadfulGecko8 months ago

When my user first authenticates onto our app, we would like to retrieve the user's entire history of events, is this possible and what is the best approach for this?

terra

Jeffadmin8 months ago

Yes, Terra does support historical backfills. To perform this, you would need to make a http request to our REST api (to the endopoint for the data type you wish to retrieve), for example:

import requests api_key = '<YOUR-API-KEY>' dev_id = '<YOUR-DEV-ID>' requests.get( 'https://api.tryterra.co/v2/daily', params={ 'start_date': '2022-01-01', 'end_date': '2024-04-01', 'user_id': '<USER-ID>', 'to_webhook': 'true' }, headers={'x-api-key': api_key, 'dev-id': dev_id} )

This will request and send the data to your webhook in chunks This method requires a webhook (or other destination) to be configured as the response may be too big for a HTTP request. Whilst this is feasible, it is not advised practice as this will slow down delivery of events to your webhook. Some providers do not allow historical backfill past a certain point (Polar, Garmin, Samsung) and other have strict ratelimits which will result in a longer period before the request is fulfilled.


Cookie Preferences

Essential CookiesAlways On
Advertisement Cookies
Analytics Cookies

Crunch Time: Embrace the Cookie Monster Within!

We use cookies to enhance your browsing experience and analyse our traffic. By clicking “Accept All”, you consent to our use of cookies according to our Cookie Policy. You can change your mind any time by visiting out cookie policy.