Quickstart
Learn how to receive data for a user's account in just 2 API requests
Last updated
Was this helpful?
Learn how to receive data for a user's account in just 2 API requests
Last updated
Was this helpful?
Learn how to receive data for an example user in two API requests.
It’s best to use your own device as an example, so you can go test with your own data. In the first step, you will connect your device provider through an authentication link (think of it like a "log in with google" link, but for Fitbit, Garmin, etc..). In the second step, you will retrieve your device’s data.
To begin, you'll need to authenticate your first example user by generating an authentication link. This link allows your end users to connect their health & fitness accounts to your application.
i) Create the Authentication URL: Use the /auth
endpoint to generate a link for the user.
ii) Redirect your user: Access the auth_url to complete the authentication process and enter your device credentials to mimic your user authentication.
You'll need your & set in the headers to successfully authenticate requests.
For now, omit all body parameters and leave them empty
Generates a link to redirect an end user to for them to select an integration and log in with their fitness data provider
/auth/generateWidgetSession
your developer ID
testingTerra
your API key
OtHJok60oQmT8zhnUWc4SWBJI7ztPTs88C0gOsJJ
Comma separated list of providers to display on the device selection page. This overrides your selected sources on your dashboard
GARMIN,FITBIT,OURA,WITHINGS,SUUNTO
Display language of the widget
en
Identifier of the end user on your system, such as a user ID or email associated with them
[email protected]
URL the user is redirected to upon successful authentication
https://myapp.com/success
URL the user is redirected to upon unsuccessful authentication
https://myapp.com/failure
Once you have completed the authentication as an example user, the user_id returned in the response above will be activated. This ID is crucial for managing user connections and retrieving their device data.
As an example, try retrieving the user's daily activity summary data using the endpoint below, using the user_id
from the response above,
Fetches daily summaries of activity metrics such as steps, distance, calories burned etc. for a given user ID
/daily
user ID to query data for
start date of data to query for - either ISO8601 date or unix timestamp
end date of data to query for - either ISO8601 date or unix timestamp
boolean flag specifying whether to send the data retrieved to the webhook, or in the response
boolean flag specifying whether to include detailed samples in the returned payload
your developer ID
testingTerra
your API key
OtHJok60oQmT8zhnUWc4SWBJI7ztPTs88C0gOsJJ
Keep going to learn how to integrate Terra into your existing environment
With the user_id, you can now retrieve user data using the endpoint (or your fitness data account may support).