sessions
Retrieving Sessions within your Organization
Retrieve recorded movement session(s).
GET https://487q8d7goe.execute-api.us-east-1.amazonaws.com/production/sessions
Obtains all of the recorded movement sessions (excluding free sessions) or specific sessions within your Valor account based on query parameters.
Query Parameters
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
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 requests
import json
# Define the API endpoint
api_url = 'your_api_url'
# Initialize an empty list to store all items
all_items = []
# Default continuation token should be an emptry string wrapped in a json
continuation_token = json.dumps("")
# Replace 'your_jwt_token' with your actual JWT token
jwt_token = 'your_jwt_token'
while True:
# 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 loop
break
else:
print(f"Error: {response.status_code}")
breakconst axios = require('axios');
const jwtToken = 'your_jwt_token_here'; // Replace with your JWT token
let continuationToken = JSON.stringify(''); // Initialize continuation token as empty JSON parameter
const apiUrl = 'your_api_url_here'; // Replace with your API endpoint URL
const allItems = [];
const fetchData = async () => {
while (true) {
const headers = {
Authorization: `Bearer ${jwtToken}`,
'X-Continuation-Token': continuationToken,
};
const params = {
'limit': '', // Replace with the limit you need (Default = '')
'athleteID': '' // Replace with the athleteID you need (Default = '')
};
try {
const response = await axios.get(apiUrl, { headers, params });
const data = response.data;
const items = 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 needed
console.log(allItems.length);
};
fetchData();import React, { useEffect, useState } from 'react';
import axios from 'axios';
const YourComponent = () => {
const [data, setData] = useState(null);
const jwtToken = 'your_jwt_token_here'; // Replace with your JWT token
let continuationToken = JSON.stringify(''); // Initialize continuation token as empty JSON
const apiUrl = 'your_api_url_here'; // Replace with your API endpoint URL
useEffect(() => {
const fetchData = async () => {
const allItems = [];
while (true) {
const headers = {
Authorization: `Bearer ${jwtToken}`,
'X-Continuation-Token': continuationToken,
};
const params = {
'limit': '', // Replace with the limit you need (Default = '')
'athleteID': '' // Replace with the athleteID you need (Default = '')
};
try {
const response = await axios.get(apiUrl, { headers, params });
const data = response.data;
const items = 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 needed
setData(allItems);
};
fetchData();
}, []);
return (
<div>
{data ? (
<pre>{JSON.stringify(data, null, 2)}</pre>
) : (
<p>Loading data...</p>
)}
</div>
);
};
export default YourComponent;import Foundation
let jwtToken = "your_jwt_token_here" // Replace with your JWT token
var continuationToken = try JSONSerialization.data(withJSONObject: "") // Initialize continuation token as empty JSON
let apiUrlString = "your_api_url_here" // Replace with your API endpoint URL
var allItems: [Any] = []
while true {
let apiURL = URL(string: apiUrlString)!
// Define the query parameters as a dictionary
let 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 parameters
var 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 in
if let error = error {
print("Error: \(error)")
} else if let data = data {
do {
let json = try JSONSerialization.jsonObject(with: data, options: [])
if let dataDict = json as? [String: Any], let items = dataDict["body"] as? [Any] {
allItems.append(contentsOf: items)
if let 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 needed
print(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)
Last updated