### Get Step Samples using HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of an HTTP/1.1 GET request to fetch activity step samples. This format is useful for understanding the raw request. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/step-samples HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Samples HTTP Request Source: https://www.polar.com/accesslink-api An example of the raw HTTP GET request to retrieve exercise sample data. This shows the necessary headers and host. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples/{type-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Activity Samples using HTTP Request Source: https://www.polar.com/accesslink-api A raw HTTP GET request example for fetching activity samples. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/activities/samples/{date} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### API Endpoint and Response Examples Source: https://www.polar.com/accesslink-api Details the GET request path for retrieving samples and provides example responses in JSON and XML formats. ```text GET /v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples Retrieve list of links to available samples in training session ### Parameters Parameter | In | Type | Required | Description ---|---|---|---|--- user-id | path | integer | true | User identifier transaction-id | path | integer | true | Transaction identifier exercise-id | path | integer | true | Exercise identifier > Example responses > 200 Response ``` ```json { "samples": [ "https://www.polaraccesslink.com/v3/users/12/exercise-transactions/34/exercises/56/samples/0", "https://www.polaraccesslink.com/v3/users/12/exercise-transactions/34/exercises/56/samples/3" ] } ``` ```xml https://www.polaraccesslink.com/v3/users/12/exercise-transactions/34/exercises/56/samples/0 https://www.polaraccesslink.com/v3/users/12/exercise-transactions/34/exercises/56/samples/3 ``` -------------------------------- ### Get Samples using Node.js Source: https://www.polar.com/accesslink-api Fetch exercise sample data using Node.js with the 'node-fetch' library. This example demonstrates setting up headers and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples/{type-id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Samples using Node.js Source: https://www.polar.com/accesslink-api Fetch sample links using Node.js with the 'node-fetch' library. This example demonstrates setting up request headers and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Example Activity Summary Response Source: https://www.polar.com/accesslink-api This is an example of a successful (200 OK) response when listing user activities. It details the structure of the returned activity data, including start and end times, durations, calories, steps, and sample data. ```json [ { "start_time": "2025-08-13T08:15:30", "end_time": "2025-08-13T23:59:59", "active_duration": "PT3H11M", "inactive_duration": "PT18H23M30S", "daily_activity": 89.1, "calories": 2500, "active_calories": 1500, "steps": 8823, "inactivity_alert_count": 1, "distance_from_steps": 4590.53, "samples": { "date": "2022-02-10", "steps": { "interval_ms": 0, "total_steps": 0, "samples": [ { "steps": 0, "timestamp": "2025-08-14T00:02" } ] }, "activity_zones": { "samples": [ { "zone": "SEDENTARY", "timestamp": "2025-08-14T00:08:30" } ] }, "inactivity_stamps": [ { "stamp": "2022-02-10T16:04" } ] } } ] ``` -------------------------------- ### Get Activity Samples using Java (HttpURLConnection) Source: https://www.polar.com/accesslink-api A Java example using HttpURLConnection to perform a GET request for activity samples. Reads the response into a string buffer. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/activities/samples/{date}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### Get Samples using Python Source: https://www.polar.com/accesslink-api Make a GET request to fetch exercise sample data using Python's 'requests' library. This example includes basic error handling for the response status code. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples/{type-id}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get GPX using HTTP/1.1 Source: https://www.polar.com/accesslink-api Example of a raw HTTP/1.1 GET request to fetch GPX data, including necessary headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/gpx HTTP/1.1 Host: www.polaraccesslink.com Accept: application/gpx+xml ``` -------------------------------- ### Get Samples using Java Source: https://www.polar.com/accesslink-api Retrieve exercise sample data using Java's built-in HttpURLConnection. This example shows how to establish a connection, set the request method, and read the response. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples/{type-id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### Get Exercise using Node.js Source: https://www.polar.com/accesslink-api Fetch exercise data using Node.js with the 'node-fetch' library. This example demonstrates making a GET request and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/exercises/{exerciseId}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Zone Samples using HTTP Request Source: https://www.polar.com/accesslink-api Example of an HTTP GET request to fetch activity zone samples, showing the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/zone-samples HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Step Samples using Java Source: https://www.polar.com/accesslink-api Retrieve activity step samples using Java's HttpURLConnection. This example demonstrates reading the response stream. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/step-samples"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### Get Exercise Summary with Node.js Source: https://www.polar.com/accesslink-api Use Node.js with the 'node-fetch' library to retrieve exercise summary data. This example demonstrates making the GET request and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Exercise Summary with Java Source: https://www.polar.com/accesslink-api Use Java's built-in HttpURLConnection to make a GET request for exercise summary data. This example demonstrates opening a connection, setting the method, and reading the response. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### Get Samples using Java Source: https://www.polar.com/accesslink-api Retrieve sample links using Java's built-in HttpURLConnection. This example shows how to set the request method and read the response stream. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### HTTP GET Request for Activity Summary Source: https://www.polar.com/accesslink-api A basic HTTP GET request structure for fetching activity summary. This example shows the request line and host header. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Step Samples using Ruby Source: https://www.polar.com/accesslink-api Retrieve activity step samples using Ruby's 'rest-client' and 'json' gems. This example shows how to parse the JSON response. ```ruby require 'rest-client' require 'json' headers = { 'Accept' => 'application/json', 'Authorization' => 'Bearer {access-token}' } result = RestClient.get 'https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/step-samples', params: { }, headers: headers p JSON.parse(result) ``` -------------------------------- ### List Exercises using Python Source: https://www.polar.com/accesslink-api Make a GET request to list exercises using Python's 'requests' library. This example includes basic error handling for the HTTP response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/exercises', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get Exercise GPX using Node.js Source: https://www.polar.com/accesslink-api Fetch exercise GPX data using Node.js with the 'node-fetch' library. This example demonstrates setting the required headers and handling the response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/gpx+xml', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/exercises/{exerciseId}/gpx', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Exercise FIT using Node.js Source: https://www.polar.com/accesslink-api Fetch exercise FIT data using Node.js with the 'node-fetch' library. This example demonstrates setting up headers and handling the response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'*/*', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/exercises/{exerciseId}/fit', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Activity Summary using Node.js Source: https://www.polar.com/accesslink-api Fetch activity summary data using Node.js with the 'node-fetch' library. This example demonstrates setting headers and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Physical Info using HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of an HTTP/1.1 GET request to fetch physical information. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/physical-information-transactions/{transaction-id}/physical-informations/{physical-info-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Webhook using HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of a raw HTTP/1.1 GET request to retrieve webhook information. ```http GET https://www.polaraccesslink.com/v3/webhooks HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Activity Samples with Java Source: https://www.polar.com/accesslink-api Use Java's HttpURLConnection to make a GET request for activity samples. The response is read and printed to the console. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/activities/samples"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### Get Exercise HTTP Request Source: https://www.polar.com/accesslink-api An example of the HTTP GET request structure for fetching exercise data. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/exercises/{exerciseId} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Example XML Response for Step Samples Source: https://www.polar.com/accesslink-api This is an example of a successful XML response when retrieving activity step samples. ```xml 2022-02-10 0 0 ``` -------------------------------- ### List Exercises using Node.js Source: https://www.polar.com/accesslink-api Fetch exercise data using Node.js with the 'node-fetch' library. This example demonstrates setting up headers and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/exercises', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Exercise Summary HTTP Request Source: https://www.polar.com/accesslink-api An example of an HTTP GET request to fetch exercise summary data. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Example 200 Response for Activity Summary Source: https://www.polar.com/accesslink-api This is an example of a successful response (200 OK) when retrieving detailed activity summaries, including various samples like steps and activity zones. ```json { "start_time": "2025-08-13T08:15:30", "end_time": "2025-08-13T23:59:59", "active_duration": "PT3H11M", "inactive_duration": "PT18H23M30S", "daily_activity": 89.1, "calories": 2500, "active_calories": 1500, "steps": 8823, "inactivity_alert_count": 1, "distance_from_steps": 4590.53, "samples": { "date": "2022-02-10", "steps": { "interval_ms": 0, "total_steps": 0, "samples": [ { "steps": 0, "timestamp": "2025-08-14T00:02" } ] }, "activity_zones": { "samples": [ { "zone": "SEDENTARY", "timestamp": "2025-08-14T00:08:30" } ] }, "inactivity_stamps": [ { "stamp": "2022-02-10T16:04" } ] } } ``` -------------------------------- ### List Activity Samples with HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of an HTTP/1.1 request to list activity samples. This shows the raw request format. ```http GET https://www.polaraccesslink.com/v3/users/activities/samples HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Nightly Recharge using HTTP Request Source: https://www.polar.com/accesslink-api A raw HTTP GET request example for the Nightly Recharge endpoint. This shows the necessary headers and host. ```http GET https://www.polaraccesslink.com/v3/users/nightly-recharge/{date} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Sleep Data using HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of an HTTP/1.1 GET request to the Polar AccessLink API for sleep data. This shows the raw request format. ```http GET https://www.polaraccesslink.com/v3/users/sleep/{date} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Exercises using Node.js Source: https://www.polar.com/accesslink-api Fetch exercise transactions using Node.js and the 'node-fetch' library. This example demonstrates setting headers and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Cardio Load by Date (HTTP Request) Source: https://www.polar.com/accesslink-api Example of an HTTP GET request to fetch cardio load data. This shows the raw request format. ```http GET https://www.polaraccesslink.com/v3/users/cardio-load/{date} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Activity by Date using HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of an HTTP/1.1 GET request to fetch activity data for a specific date. This shows the raw request format. ```http GET https://www.polaraccesslink.com/v3/users/users/activities/{date} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Register User HTTP Request Example Source: https://www.polar.com/accesslink-api An example of an HTTP POST request to register a user, including host and content type headers. ```http POST https://www.polaraccesslink.com/v3/users HTTP/1.1 Host: www.polaraccesslink.com Content-Type: application/xml Accept: application/json ``` -------------------------------- ### Example Response for Activity Samples Source: https://www.polar.com/accesslink-api This is an example of a successful JSON response when listing user activity samples. It includes daily data points like steps and activity zones. ```json [ { "date": "2022-02-10", "steps": { "interval_ms": 0, "total_steps": 0, "samples": [ { "steps": 0, "timestamp": "2025-08-14T00:02" } ] }, "activity_zones": { "samples": [ { "zone": "SEDENTARY", "timestamp": "2025-08-14T00:08:30" } ] }, "inactivity_stamps": [ { "stamp": "2022-02-10T16:04" } ] } ] ``` -------------------------------- ### Get Heart Rate Zones HTTP Request Source: https://www.polar.com/accesslink-api Example of the raw HTTP GET request to fetch heart rate zones. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/heart-rate-zones HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Activity Step Samples Wrapper Source: https://www.polar.com/accesslink-api A wrapper model for partner step samples, providing the date, sample interval in minutes, and a list of individual step samples. ```json { "date": "2022-02-10", "interval": 0, "samples": [ { "steps": 0, "time": "12:37:33.000" } ] } ``` -------------------------------- ### HTTP GET Request for Available Sleep Times Source: https://www.polar.com/accesslink-api A basic HTTP/1.1 GET request example for the available sleep times endpoint. This shows the request line and host header. ```http GET https://www.polaraccesslink.com/v3/users/sleep/available HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Activities using Node.js Source: https://www.polar.com/accesslink-api Fetch activity transaction data using Node.js and the 'node-fetch' library. This example demonstrates setting up headers and handling the JSON response. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Sleep Data using Python Source: https://www.polar.com/accesslink-api Use Python's 'requests' library to get sleep data. This example includes basic error handling for the HTTP response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/sleep/{date}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get Step Samples using Python Source: https://www.polar.com/accesslink-api Make a GET request to retrieve activity step samples using Python's 'requests' library. Handles both successful responses and errors. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}/step-samples', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### HTTP GET Request for Circadian Bedtime Data Source: https://www.polar.com/accesslink-api A basic HTTP/1.1 GET request example for retrieving circadian bedtime data. This shows the request line and essential headers. ```http GET https://www.polaraccesslink.com/v3/users/sleepwise/circadian-bedtime/date?from=2019-08-24&to=2019-08-24 HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Activity Samples with Node.js Source: https://www.polar.com/accesslink-api Use Node.js with the 'node-fetch' library to asynchronously fetch activity samples. The response is parsed as JSON. ```javascript const fetch = require('node-fetch'); const headers = { 'Accept':'application/json', 'Authorization':'Bearer {access-token}' }; fetch('https://www.polaraccesslink.com/v3/users/activities/samples', { method: 'GET', headers: headers }) .then(function(res) { return res.json(); }).then(function(body) { console.log(body); }); ``` -------------------------------- ### Get Continuous Heart Rate Samples (HTTP Request) Source: https://www.polar.com/accesslink-api An example of an HTTP GET request to fetch continuous heart rate data. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/continuous-heart-rate/{date} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Exercises using HTTP/1.1 Source: https://www.polar.com/accesslink-api A raw HTTP/1.1 request example for listing exercise transactions. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Exercise FIT using Python Source: https://www.polar.com/accesslink-api Use the 'requests' library in Python to get exercise FIT data. This example includes basic error handling for the HTTP response. ```python import requests headers = { 'Accept': '*/*', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/exercises/{exerciseId}/fit', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Activity Summary JSON Response Example Source: https://www.polar.com/accesslink-api Example of a successful (200 OK) response containing activity summary details in JSON format. ```json { "id": 1234, "polar-user": "https://www.polaraccesslink/v3/users/1", "transaction-id": 179879, "date": "2010-12-31", "created": "2016-04-27T20:11:33.000Z", "calories": 2329, "active-calories": 428, "duration": "PT2H44M", "active-steps": 250 } ``` -------------------------------- ### Get Activity Summary using Python Source: https://www.polar.com/accesslink-api Use Python's 'requests' library to get activity summary data. This example includes basic error handling for the HTTP response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id}/activities/{activity-id}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### List Activities with Java Source: https://www.polar.com/accesslink-api Retrieve daily activities using Java's built-in `HttpURLConnection`. This example shows how to establish a connection, set the request method, and read the response stream. ```java URL obj = new URL("https://www.polaraccesslink.com/v3/users/activities"); HttpURLConnection con = (HttpURLConnection) obj.openConnection(); con.setRequestMethod("GET"); int responseCode = con.getResponseCode(); BufferedReader in = new BufferedReader( new InputStreamReader(con.getInputStream())); String inputLine; StringBuffer response = new StringBuffer(); while ((inputLine = in.readLine()) != null) { response.append(inputLine); } in.close(); System.out.println(response.toString()); ``` -------------------------------- ### Get Available Sleep Times with Python Source: https://www.polar.com/accesslink-api Use Python's 'requests' library to get available sleep times. This example includes basic error handling for the HTTP response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/sleep/available', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get Samples using Python Source: https://www.polar.com/accesslink-api Make a GET request to fetch sample links using Python's 'requests' library. It includes basic error handling for the HTTP response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get Cardio Load by Date (Python) Source: https://www.polar.com/accesslink-api Use Python's requests library to get cardio load data. This example includes basic error handling for the API response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/cardio-load/{date}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Initiate Daily Activity Transaction with Python Source: https://www.polar.com/accesslink-api This Python example uses the 'requests' library to send a POST request for daily activity data. It checks the response status and prints the JSON data or the response object. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.post('https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### List Activity Samples with cURL Source: https://www.polar.com/accesslink-api Use cURL to make a GET request to retrieve activity samples. Ensure you include the Accept and Authorization headers. ```shell # You can also use wget curl -X GET https://www.polaraccesslink.com/v3/users/activities/samples \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' ``` -------------------------------- ### Get FIT Exercise Data using Python Source: https://www.polar.com/accesslink-api Use Python's 'requests' library to get exercise data in FIT format. This example demonstrates setting headers and handling both successful and error responses. ```python import requests headers = { 'Accept': '*/*', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/fit', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get Activity Samples using Python (requests) Source: https://www.polar.com/accesslink-api Employ the requests library in Python to fetch activity samples. Includes basic error handling for the response. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/activities/samples/{date}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Get Historical Cardio Load Data (Python) Source: https://www.polar.com/accesslink-api Use Python's 'requests' library to get historical cardio load data. This example includes error handling for non-successful HTTP status codes. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/cardio-load/period/days/{days}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### Example JSON Response for Step Samples Source: https://www.polar.com/accesslink-api This is an example of a successful JSON response when retrieving activity step samples. ```json { "date": "2022-02-10", "interval": 0, "samples": [ { "steps": 0, "time": "12:37:33.000" } ] } ``` -------------------------------- ### Create Webhook HTTP Request Example Source: https://www.polar.com/accesslink-api An example of the raw HTTP POST request to create a webhook, including host and content headers. ```http POST https://www.polaraccesslink.com/v3/webhooks HTTP/1.1 Host: www.polaraccesslink.com Content-Type: application/json Accept: application/json ``` -------------------------------- ### Get Historical Cardio Load Data (HTTP Request) Source: https://www.polar.com/accesslink-api Example of an HTTP GET request to fetch historical cardio load data. This shows the raw request format including host and accept headers. ```http GET https://www.polaraccesslink.com/v3/users/cardio-load/period/days/{days} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Activity Summary XML Response Example Source: https://www.polar.com/accesslink-api Example of a successful (200 OK) response containing activity summary details in XML format. ```xml 1234 https://www.polaraccesslink/v3/users/1 179879 2010-12-31 2016-04-27T20:11:33.000Z 2329 428 PT2H44M 250 ``` -------------------------------- ### List Sleep Nights (HTTP Request) Source: https://www.polar.com/accesslink-api An example of an HTTP GET request to the sleep endpoint, showing the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/sleep HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Exercises using Python Source: https://www.polar.com/accesslink-api Make a GET request to fetch exercise transactions using Python's 'requests' library. This example includes basic error handling for the response status code. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.get('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### HTTP Request for User Information Source: https://www.polar.com/accesslink-api An example of an HTTP GET request to the users endpoint, showing the required Host and Accept headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### List Activities HTTP Request Source: https://www.polar.com/accesslink-api An example of the raw HTTP GET request to list activities. This shows the required headers and host for the request. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/activity-transactions/{transaction-id} HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Create Exercise Transaction (Python) Source: https://www.polar.com/accesslink-api Python example using the 'requests' library to POST a request for creating an exercise transaction. It handles successful responses and errors. ```python import requests headers = { 'Accept': 'application/json', 'Authorization': 'Bearer {access-token}' }; r = requests.post('https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions', headers = headers ) if r.status_code >= 200 and r.status_code < 400: print(r.json()) else: print(r) ``` -------------------------------- ### HTTP Request for TCX Data Source: https://www.polar.com/accesslink-api A raw HTTP GET request example for fetching TCX exercise data. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/tcx HTTP/1.1 Host: www.polaraccesslink.com Accept: application/vnd.garmin.tcx+xml ``` -------------------------------- ### Get Samples using cURL Source: https://www.polar.com/accesslink-api Use cURL to make a GET request to retrieve available sample links. Ensure you include the correct Authorization header with your access token. ```shell # You can also use wget curl -X GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {access-token}' ``` ```http GET https://www.polaraccesslink.com/v3/users/{user-id}/exercise-transactions/{transaction-id}/exercises/{exercise-id}/samples HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### HTTP Request for Cardio Load Source: https://www.polar.com/accesslink-api A raw HTTP GET request example for retrieving cardio load data. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/cardio-load/date?from=2019-08-24&to=2019-08-24 HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### XML Response Example for Zone Samples Source: https://www.polar.com/accesslink-api Example of a successful XML response containing activity zone samples, mirroring the JSON structure. ```xml 2022-02-10 0 1 PT51M5S ``` -------------------------------- ### List Cardio Loads using HTTP/1.1 Source: https://www.polar.com/accesslink-api An example of an HTTP/1.1 GET request to retrieve cardio load data. This shows the request line and headers. ```http GET https://www.polaraccesslink.com/v3/users/cardio-load HTTP/1.1 Host: www.polaraccesslink.com Accept: application/json ``` -------------------------------- ### Get Available Sleep Times Source: https://www.polar.com/accesslink-api Retrieves the dates with sleep start and end times for which the user has sleep data available in the last 28 days. ```APIDOC ## GET /v3/users/sleep/available ### Description Get the dates with sleep start and end times, where user has sleep data available in the last 28 days. ### Method GET ### Endpoint /v3/users/sleep/available ### Parameters #### Query Parameters None #### Request Body None ### Request Example None ### Response #### Success Response (200) - **available** (array) - An array of sleep data objects, each containing date, start_time, and end_time. #### Response Example ```json { "available": [ { "date": "2020-01-01", "start_time": "2020-01-01T00:39:07+03:00", "end_time": "2020-01-01T09:39:07+03:00" } ] } ``` ### Error Handling - **403 Forbidden**: User has not accepted all mandatory consents. ```