Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Recent Weight & Body Fat

ANSWERED

I'm able to get the weight & body fat for a specific date, but how can I simply get the latest/most recent data?

 

The documentation says:

"If you need to fetch only the most recent entry, you can use the Get Body Measurements endpoint."

 

But it then doesn't specify anywhere how to do this (to my knowledge).

 

Can anybody point me in the right direction?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

@Grimster So here's a possible solution using time series:

 

Weight

https://api.fitbit.com/1/user/-/body/weight/date/today/1d.json

  • This will return the last known weight measurement (even if you don't have a weight logged for 'today').

 

Body Fat

https://api.fitbit.com/1/user/-/body/fat/date/today/7d.json

  • This will return the last 7 days with the most recent day being the latest measurement. The reason I have it set to '7d' as opposed to '1d' is because '1d' was returning 0 and not giving the latest measurement (wasn't behaving the same as the weight endpoint).

Hopefully that helps. Robot Happy

Andrew | Community Moderator, Fitbit

What motivates you?

View best answer in original post

Best Answer
0 Votes
5 REPLIES 5

@Grimster Sorry for the confusion, you'll need to specify a date with that endpoint. You won't be able to just pull the most recent measurement.

 

I usually use this:

https://api.fitbit.com/1/user/-/body/date/today.json

 

But if you don't have data for 'today' it will return 0.

 

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes
Isn't there another endpoint to get the last logged weight & body fat %?
Would be a logical thing to have in the app wouldn't it?

Otherwise I will have to cheer dvd today, if it doesn't have it a date range for a week...then a month..etc u until I find it. But that will take up a lot of unnecessary api calls
Best Answer
0 Votes
Nice autocorrected typos :), what I meant to say:

Isn't there another endpoint to get the last logged weight & body fat %?
Would be a logical thing to have in the api wouldn't it?

Otherwise I will have to check the logs for today, if it doesn't have it I will have to check a date range for a week...then a month..etc u until I find it. But that will take up a lot of unnecessary api calls
Best Answer
0 Votes

@Grimster So here's a possible solution using time series:

 

Weight

https://api.fitbit.com/1/user/-/body/weight/date/today/1d.json

  • This will return the last known weight measurement (even if you don't have a weight logged for 'today').

 

Body Fat

https://api.fitbit.com/1/user/-/body/fat/date/today/7d.json

  • This will return the last 7 days with the most recent day being the latest measurement. The reason I have it set to '7d' as opposed to '1d' is because '1d' was returning 0 and not giving the latest measurement (wasn't behaving the same as the weight endpoint).

Hopefully that helps. Robot Happy

Andrew | Community Moderator, Fitbit

What motivates you?

Best Answer
0 Votes

I tried the following end-points:

 

Weight

https://api.fitbit.com/1/user/{user-id}/body/weight/date/today/1d.json

 

Fat

https://api.fitbit.com/1/user/{user-id}/body/fat/date/today/1d.json

 

Both returned 1 entry with a datestamp of today but with the most recent (last) weight or fat value.

I haven't stepped on my aria for over a week just to test it out Smiley Tongue

 

But both worked as you described, so maybe they fixed the fat end-point to match the weight end-point.

 

Thank you Andrew, you saved the day Smiley Happy

Best Answer
0 Votes