# Measure - GetMeas
WARNING
The data are only available once a synchronization occured between the device and Withings servers (which might include synchronizing with Withings mobile application or via Withings Mobile SDK).
Measure - GetMeas (opens new window) provides measures stored at a specific date.
WARNING
The measures reported seems to be the manually recorded measures by the user or when the user requests a specific test/measure, starting a test (ex. ECG, SPO2) using the device.
In WithingsFlutter, the response object is expressed by the WithingsMeasureGetMeasData. In particular, an instance of WithingsMeasureGetMeasData has the following fields:
/// Response status
int? status;
/// Array of measure group
List<Measuregrps>? measuregrps;
where Measuregrps object is:
/// UNIX timestamp when measures were taken
int? date;
/// Category for the measures in the group (see category input parameter)
int? category;
/// List of single measures
List<SingleMeas>? measures;
where SingleMeas object is:
/// Type of the measure. See meastypes input parameter
int? type;
/// Value for the measure in S.I. units (kilograms, meters etc...).
double? value;
TIP
For more info about the status check the Withings API documentation Response Status (opens new window) section.
TIP
For more info about the values check the the Withings API documentation Measure - GetMeas (opens new window) in the Query Parameters section.
For example:
WithingsMeasureGetMeasData(status: 0, measuregrps: [Measuregrps(date: 1662859383, category: 1, measures: [SingleMeas(type: 54, value: 96.0, )], ), Measuregrps(date: 1662859346, category: 1, measures: [SingleMeas(type: 54, value: 100.0, )], ), Measuregrps(date: 1662859029, category: 1, measures: [SingleMeas(type: 11, value: 44.0, ), SingleMeas(type: 135, value: 93.0, ), SingleMeas(type: 136, value: 163.0, ), SingleMeas(type: 137, value: 433.0, ), SingleMeas(type: 138, value: 370.0, )], )], )
Informations about the measures stored at a specific date can be obtained in three steps:
# Step 1: Instantiate a manager
First, you need to instanciate a WithingsMeasureGetMeasDataManager
WithingsMeasureGetMeasDataManager withingsMeasureGetMeasDataManager = WithingsMeasureGetMeasDataManager();
# Step 2: Create the request url
Then, you have to create a url object that can be of two different types that fetches the measures stored at a specific date:
WithingsMeasureAPIURL.getMeasRangewhere you have to set the:accessTokenstartdateas UNIX Timestamp to define the range of time of measures to be retrievedenddateas UNIX Timestamp to define the range of time of measures to be retrieved
Then, if you want, you can set the:
meastypesis aString: a list of requested measure types (separated by a comma)categoryand set1for real measures,2for user objectives
For example:
WithingsMeasureAPIURL withingsMeasureAPIURLGetMeasRange =
WithingsMeasureAPIURL.getMeasRange(
startdate: 1662857663,
enddate: 1662882863,
//meastypes: '11, 54', //Not necessary
category: 1, //Not necessary
accessToken: withingsCredentials.withingsAccessToken,
);
WithingsMeasureAPIURL.getMeasLastupdatewhere you have to set the:accessTokenlastupdateas UNIX Timestamp for requesting data that were updated or created after this date
Then, if you want, you can set the:
meastypesis aString: a list of requested measure types (separated by a comma)categoryand set1for real measures,2for user objectives
For example:
WithingsMeasureAPIURL withingsMeasureAPIURLGetMeasLastupdate =
WithingsMeasureAPIURL.getMeasLastupdate(
lastupdate: 1662920834,
//meastypes: '11, 54', //Not necessary
//category: 1, //Not necessary
accessToken: withingsCredentials.withingsAccessToken,
);
WARNING
The field meastypes seems not to be useful, cause the results with or without are the same
TIP
For more info about the meastypes values check the Withings API documentation Measure - GetMeas (opens new window) in the Query Parameters section.
# Step 3: Get the data
Finally you can obtain the measures stored at a specific date using
WithingsMeasureGetMeasData getmeasrange =
await withingsMeasureGetMeasDataManager
.fetch(withingsMeasureAPIURLGetMeasRange);
or
WithingsMeasureGetMeasData getmeasupdate =
await withingsMeasureGetMeasDataManager
.fetch(withingsMeasureAPIURLGetMeasLastupdate);
depending on the URL object.