Get the activity streaks
const url = 'http://localhost:8080/api/v1/metrics/streaks';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url http://localhost:8080/api/v1/metrics/streaks \ --header 'Authorization: Bearer <token>'Returns the current and longest streak of consecutive days, weeks (Monday to Sunday) and months.
GET /api/v1/metrics/streaks?filters[sportType]=Run,TrailRun
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”object
One sport type, or several separated by commas. Every sport type counts when left out.
Responses
Section titled “Responses”The day, week and month streaks.
object
object
The length of the streak that is still running. It is 0 when the streak was broken.
The day of the first activity in the current streak, or null when there is no current streak.
The length of the longest streak ever.
The day of the first activity in the longest streak, or null when there are no activities. The most recent one wins when several streaks are equally long.
The day of the last activity in the longest streak, or null when there are no activities.
object
The length of the streak that is still running. It is 0 when the streak was broken.
The day of the first activity in the current streak, or null when there is no current streak.
The length of the longest streak ever.
The day of the first activity in the longest streak, or null when there are no activities. The most recent one wins when several streaks are equally long.
The day of the last activity in the longest streak, or null when there are no activities.
object
The length of the streak that is still running. It is 0 when the streak was broken.
The day of the first activity in the current streak, or null when there is no current streak.
The length of the longest streak ever.
The day of the first activity in the longest streak, or null when there are no activities. The most recent one wins when several streaks are equally long.
The day of the last activity in the longest streak, or null when there are no activities.
Example
{ "day": { "current": 3, "currentStartDate": "2023-07-31", "longest": 12, "longestStartDate": "2023-03-06", "longestEndDate": "2023-03-17" }, "week": { "current": 3, "currentStartDate": "2023-07-31", "longest": 12, "longestStartDate": "2023-03-06", "longestEndDate": "2023-03-17" }, "month": { "current": 3, "currentStartDate": "2023-07-31", "longest": 12, "longestStartDate": "2023-03-06", "longestEndDate": "2023-03-17" }}Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "bad_request", "message": "\"filters[sportType]\" contains an unknown sport type."}The Authorization header was missing, malformed, or did not match the configured key.
Every error uses this shape.
object
A stable, machine readable code.
Examples
{ "error": "invalid_token", "message": "A valid API token is required. Send it in the Authorization header as a Bearer token."}