cyberjunky / python-garminconnect

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

Set hydration data [Feature request] #204

Closed svanhoutte closed 4 months ago

svanhoutte commented 6 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 6 months 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 6 months ago

Thanks a lot @psdupvi

psdupvi commented 6 months 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 6 months ago

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

svanhoutte commented 6 months ago

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

cyberjunky commented 4 months ago

Closing this, since implemented by @psdupvi and requested and tested by @svanhoutte, thanks both!