Open linuxlurak opened 1 month ago
Another idea would be to move these API definitions to an external file so that the community can react more quickly to changes. Systematic monitoring might even be conceivable.
I think there is already the connectapi
method
def connectapi(self, path, **kwargs):
return self.garth.connectapi(path, **kwargs)
There are some examples of its usage to POST in add_body_composition
and add_weigh_in
, and I think it actually serves as the requester for all the get_
endpoints. There's also a PUT for add_hydration_data
It's not particularly well documented here, since it's technically a garth method:
def connectapi(self, path: str, method="GET", **kwargs):
resp = self.request(method, "connectapi", path, api=True, **kwargs)
if resp.status_code == 204:
rv = None
else:
rv = resp.json()
return rv
I think this should roughly allow what you want, although it's not a bad idea to add some more formal documentation. I don't necessarily think it's worth adding our own version of the method here, since then we're just duplicating work
Hi,
What do you think of the idea of having some kind of generic API call option? This would allow me to do weigh-ins with date, for example. The call on the garmin connect website is like this:
Payload:
The remote part in the POST is most likely not necessary.