# Get Temperature (Skin) Data
TIP
This guide assumes that your app has already been authorized and the snippet of code that I will show you can access to a valid FitbitCredentials
instance, here called fitbitCredentials
, the Fitbit OAuth 2.0 client ID, here called clientID
, and the Fitbit client secret, here called clientSecret
.
Temperature (Skin) data (opens new window) contain details about a user's Temperature (Skin) data. In Fitbitter, a datapoint is expressed by the FitbitTemperatureSkinData
model.
In particular, an instance of FitbitTemperatureSkinData
has the following fields:
/// The user encoded id.
String? userID;
/// The date of monitoring of the data.
DateTime? dateOfMonitoring;
/// The value of the data.
double? value;
// The type of skin temeperature log created.
String? logType;
An example is:
FitbitTemperatureSkinData(userID: 7ML2XV, dateOfMonitoring: 2022-05-08 00:00:00.000, value: 0.3, logType: 'dedicated_temp_sensor',)
Information about the user's Temperature (Skin) data can be obtained in three steps:
# Step 1: Instanciate a manager
First, you need to instanciate a FitbitTemperatureSkinDataManager
FitbitTemperatureSkinDataManager fitbitTemperatureSkinDataManager = FitbitTemperatureSkinDataManager(
clientID: '<OAuth 2.0 Client ID>',
clientSecret: '<Client Secret>',
);
# Step 2: Create the request url
Then, you have to create a url object, FitbitTemperatureSkinAPIURL
to fetch the Temperature (Skin) data as:
FitbitTemperatureSkinAPIURL fitbitTemperatureSkinAPIURL = FitbitTemperatureSkinAPIURL.day(
date: DateTime.now(),
fitbitCredentials: fitbitCredentials,
);
where date
is the day you want to fetch FitbitTemperatureSkinData
from and fitbitCredentials
is the FitbitCredentials
instance obtained during the authentication step.
TIP
For the complete list of possible FitbitTemperatureSkinAPIURL
, defined for different time ranges, please refer to the API Doc (opens new window).
# Step 3: Get the data
Finally you can obtain the Temperature (Skin) data using
List<FitbitTemperatureSkinData> fitbitTemperatureSkinData = await fitbitTemperatureSkinDataManager.fetch(fitbitTemperatureSkinAPIURL);