cyberjunky / python-garminconnect

Python 3 API wrapper for Garmin Connect to get activity statistics
MIT License
796 stars 130 forks source link

Set hydration data [Feature request] #204

Open svanhoutte opened 2 months ago

svanhoutte commented 2 months ago

Thanks for this great project ! @cyberjunky Would you be able to add a function to set the hydration data ? the same way you set the blood pressure data ? That would be really useful.

thanks

psdupvi commented 1 month ago

It looks like the URL would be usersummary-service/usersummary/hydration/log or something similar, and the payload is

"calendarDate": "2024-05-15"
"timestampLocal": "2024-05-15T07:12:51.180"
"userProfileId": 71328280, 
"valueInML": 236.588

No matter which setting I use on GC (e.g., Ounces, Cups, or ml), the endpoint takes a "valueInML", never "valueInOz" or "valueInCups"

I can take a look at this after work today

svanhoutte commented 1 month ago

Thanks a lot @psdupvi

psdupvi commented 1 month ago

https://github.com/cyberjunky/python-garminconnect/pull/205

This will be available when merged, but if you want to start early, the code is visible there and can be copied -- from __init__.py, you'll need the URL and the function definition

Call looks like this: api.add_hydration_data(value_in_ml=240,cdate='2024-05-15',timestamp='2024-05-15T09:50:42.257671')

cdate and timestamp are both optional and default to now

value_in_ml can be positive or negative, and can support values up to 65,534 ml.

svanhoutte commented 1 month ago

@psdupvi Thanks a lot, gonna test this asap ! hopefully today

svanhoutte commented 1 month ago

Working Great ! thanks a lot ! exactly what i needed !