Obtains all of the recorded movement sessions (excluding free sessions) or specific sessions within your Valor account based on query parameters.
Query Parameters
Name
Type
Description
athleteID
String
Valor ID of a specific athlete to retrieve subset of sessions (can be extracted from athletes call)
limit
String
Limited number of total sessions to return (used for pagination)
Headers
Name
Type
Description
Authorization*
String
JWT Bearer Token for authentication:
Bearer <JWT token>
X-Continuation-Token*
String
Continuation token required for paginating requests. Can be found within the response. Default value should be an empty string encoded as a JSON
{"statusCode":200,"X-Continuation-Token":"{Continuation Token}",//null when all sessions retrieved"body": [] //Array of sessions found}
{"message":"String type - this will contain more details about the problem encountered"}
{"message":"String type - this will contain more details about the problem encountered"}
Note: When retrieving multiple sessions it is highly recommended to paginate your requests using the limit & X-Continuation-Token parameters. See examples below:
import requestsimport json# Define the API endpointapi_url ='your_api_url'# Initialize an empty list to store all itemsall_items = []# Default continuation token should be an emptry string wrapped in a jsoncontinuation_token = json.dumps("")# Replace 'your_jwt_token' with your actual JWT tokenjwt_token ='your_jwt_token'whileTrue:# Create headers with the X-Continuation-Token and JWT token headers ={'X-Continuation-Token': continuation_token,# Include the continuation token'Authorization':f'Bearer {jwt_token}'}# Define query parameters params ={'limit':'',# Replace with the limit you need (Default = '')'athleteID':''# Replace with the athlete ID you need (Default = '')}# Make the API request with the headers and query parameters response = requests.get(api_url, headers=headers, params=params)if response.status_code ==200: data = response.json() items = json.loads(data.get('body'))# Append the items from the current page to the list all_items.extend(items)# Check if there's a next page continuation_token = data.get('X-Continuation-Token')if continuation_token !="null": continuation_token = json.dumps(continuation_token)if continuation_token =="null":# No more pages to fetch, exit the loopbreakelse:print(f"Error: {response.status_code}")break
constaxios=require('axios');constjwtToken='your_jwt_token_here'; // Replace with your JWT tokenlet continuationToken =JSON.stringify(''); // Initialize continuation token as empty JSON parameterconstapiUrl='your_api_url_here'; // Replace with your API endpoint URLconstallItems= [];constfetchData=async () => {while (true) {constheaders= { Authorization:`Bearer ${jwtToken}`,'X-Continuation-Token': continuationToken, };constparams= {'limit':'',// Replace with the limit you need (Default = '')'athleteID':''// Replace with the athleteID you need (Default = '') };try {constresponse=awaitaxios.get(apiUrl, { headers, params });constdata=response.data;constitems=JSON.parse(data.body);allItems.push(...items); continuationToken = data['X-Continuation-Token'];if (continuationToken !=='null') { continuationToken =JSON.stringify(continuationToken) }if (continuationToken ==='null') {break; // No more pages to fetch } } catch (error) {console.error('Error:', error);break; } }// Process allItems as neededconsole.log(allItems.length);};fetchData();
import React, { useEffect, useState } from'react';import axios from'axios';constYourComponent= () => {const [data,setData] =useState(null);constjwtToken='your_jwt_token_here'; // Replace with your JWT tokenlet continuationToken =JSON.stringify(''); // Initialize continuation token as empty JSONconstapiUrl='your_api_url_here'; // Replace with your API endpoint URLuseEffect(() => {constfetchData=async () => {constallItems= [];while (true) {constheaders= { Authorization:`Bearer ${jwtToken}`,'X-Continuation-Token': continuationToken, };constparams= {'limit':'',// Replace with the limit you need (Default = '')'athleteID':''// Replace with the athleteID you need (Default = '') };try {constresponse=awaitaxios.get(apiUrl, { headers, params });constdata=response.data;constitems=JSON.parse(data.body);allItems.push(...items); continuationToken = data['X-Continuation-Token'];if (continuationToken !=='null) { continuationToken =JSON.stringify(continuationToken); }if (continuationToken ==='null') { break; // No more pages to fetch } } catch (error) { console.error('Error:', error); break; } }// Process allItems as neededsetData(allItems); };fetchData(); }, []);return ( <div> {data ? ( <pre>{JSON.stringify(data,null,2)}</pre> ) : ( <p>Loading data...</p> )} </div> );};exportdefault YourComponent;
importFoundationlet jwtToken ="your_jwt_token_here"// Replace with your JWT tokenvar continuationToken =try JSONSerialization.data(withJSONObject:"")// Initialize continuation token as empty JSONlet apiUrlString ="your_api_url_here"// Replace with your API endpoint URLvar allItems: [Any] = []whiletrue {let apiURL =URL(string: apiUrlString)!// Define the query parameters as a dictionarylet queryParameters: [String:String] = ["limit":"", // Replace with the limit you need (Default = '')"athleteID":""// Replace with the athleteID you need (Default = '') ]// Create a URLComponents object to handle query parametersvar components =URLComponents(url: apiUrl, resolvingAgainstBaseURL:false) components?.queryItems = queryParameters.map { URLQueryItem(name: $0, value: $1) }var request =URLRequest(url: components?.url?? apiURL) request.httpMethod ="GET" request.setValue("Bearer \(jwtToken)", forHTTPHeaderField:"Authorization") request.setValue(continuationToken, forHTTPHeaderField:"X-Continuation-Token")let task = URLSession.shared.dataTask(with: request) { data, response, error iniflet error = error {print("Error: \(error)") } elseiflet data = data {do {let json =try JSONSerialization.jsonObject(with: data, options: [])iflet dataDict = json as? [String:Any], let items = dataDict["body"]as? [Any] { allItems.append(contentsOf: items)iflet newContinuationToken = dataDict["X-Continuation-Token"]as?String { continuationToken =try JSONSerialization.data(withJSONObject: newContinuationToken) } else { continuationToken ="null" } } } catch {print("Error parsing JSON: \(error)") } } } task.resume()if continuationToken =="null" {break// No more pages to fetch }}// Process allItems as neededprint(allItems)
Response (Body) Parameters
Session ID: The unique ID of each session
Date: The date the session was recorded (UTC)
s3Key: The s3Key associated with the session. Note: This is critical to use to obtain IK or Valor report data.
Duration: The duration of the session in seconds
Athlete ID: The unique athlete ID of each session
Assessment ID: The unique assessment ID of each session (shared with sessions recorded under the same assessment) or labeled as "singleExercise" if the session was a stand alone recording
Exercise ID: The unique exercise ID of each session
Session Name: The name of the session (usually the name of an exercise)