Get the training volume
GET
/api/v1/metrics/training-volume
const url = 'http://localhost:8080/api/v1/metrics/training-volume?filters%5Bfrom%5D=2023-09-04&filters%5Bto%5D=2023-09-10&filters%5BsportType%5D=Ride';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/training-volume?filters%5Bfrom%5D=2023-09-04&filters%5Bto%5D=2023-09-10&filters%5BsportType%5D=Ride' \ --header 'Authorization: Bearer <token>'Returns the total number of activities, moving time, distance, elevation and calories in a date range
GET /api/v1/metrics/training-volume?filters[from]=2023-09-04&filters[to]=2023-09-10&filters[sportType]=Run
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Query Parameters
Section titled “Query Parameters”filters
required
object
from
required
The first day of the range
string format: date
to
required
The last day of the range, not before from
string format: date
sportType
One sport type, or several separated by commas. Every sport type counts when left out.
string
Responses
Section titled “Responses”The training volume for the date range.
Media typeapplication/json
object
from
required
string format: date
to
required
string format: date
numberOfActivities
required
integer
movingTimeInSeconds
required
integer
distanceInMeter
required
integer
elevationInMeter
required
integer
calories
required
integer
Example
{ "from": "2023-09-04", "to": "2023-09-10", "numberOfActivities": 4, "movingTimeInSeconds": 14400, "distanceInMeter": 82300, "elevationInMeter": 910, "calories": 2350}Media typeapplication/json
Every error uses this shape.
object
error
required
A stable, machine readable code.
string
message
required
string
Examples
{ "error": "bad_request", "message": "\"filters[from]\" is required."}{ "error": "bad_request", "message": "\"filters[from]\" must not be later than \"filters[to]\"."}{ "error": "bad_request", "message": "\"filters[sportType]\" contains an unknown sport type."}The Authorization header was missing, malformed, or did not match the configured key.
Media typeapplication/json
Every error uses this shape.
object
error
required
A stable, machine readable code.
string
message
required
string
Examples
ExampleinvalidToken
{ "error": "invalid_token", "message": "A valid API token is required. Send it in the Authorization header as a Bearer token."}Headers
Section titled “Headers”WWW-Authenticate
string