Q: Getting Garmin Cycling events

CompactBasilisk1 month ago

I want to capture my Garmin user’s cycling sessions. How would I be able to get these payloads through Terra API?

terra

Jeffadmin1 month ago

Hey there

You can easily retrieve Garmin activity sessions by making a GET request to the /activity endpoint using the Terra REST API. When making the request, specify the start_date and end_date for the time period you would like to retrieve activities for, as well as to_webhook=false if you dont want the data to be sent to your configured destination and returned in the response body (note that if data for this period has not been requested before, you may have to make the request again after 180 seconds as Garmin takes some time to aggregate the data).

Once our API returns the activity data, filter through the data: [...] array for objects with the metadata.type field equaling 1 (ActivityType.CYCLING). There is also:

  • Handbiking -> 14
  • Mountain Biking -> 15
  • Road Biking -> 16
  • Spinning -> 17
  • Stationary Biking -> 18
  • Utility Biking -> 19
  • Motorbiking -> 137

You can see the full list of activity types here