ondrej1024 / carelink-python-client

Experimental Medtronic CareLink Client in Python
GNU Affero General Public License v3.0
39 stars 21 forks source link

400 Forbidden Error when fetching last 24h data #4

Closed Pourbaix closed 1 year ago

Pourbaix commented 1 year ago

Hello ondrej, I'm using this implementation since a few months now and it worked perfectly until this morning. I can not manage to recover data from the API anymore and it gives me a 400 "Forbidden" error message.

After some research, it looks like the connection process is fine and that the error comes from this route: "https://clcloud.minimed.eu/connect/carepartner/v6/display/message" Right now, we make a POST request to this route providing the auth token and a url-encoded form containing the username and the role but it seems like they have changed something with their API and that it needs something new.

So i was wondering if someone out there has the same problem and how can we find a solution for this ?

hhuitema commented 1 year ago

Something has changed on Carelink.. Using the app i can now follow multiple people. So i guess on the technical side some url's and XML messages have changed.

This might be a big problem to fix.

ondrej1024 commented 1 year ago

This started happening to me as well yesterday. Surely it is caused by an API change on the Carelink side. The issue is being discussed here. I don't think there is a solution yet.

Pourbaix commented 1 year ago

Ok it works now ! Just by adding the patient username to the body of the POST request it works again: image Replace "yourpatientusername" with the username of the patient you want data of. NOTE: Im currently using a care partner account so I dont now if it works for other types of account.

ondrej1024 commented 1 year ago

I can confirm that adding the "patientId" to the data request works. So as a quick fix we might consider just adding a new parameter to the carelink_client_cli.py program where the patient Id can be specified, which is then passed on to the library.

However, a complete solution might be a bit more complex. In the xDripCareLinkFollower I see a lot of pull requests which implement the "Multi follow" feature. These would need to be ported to the carelink-python-client.

Pourbaix commented 1 year ago

If you want to implement the 'multi-follow' feature, I think in the issue you gave me previously they talk about a route (supposedly https://carelink.minimed.eu/patient/m2m/links/patients) that recovers all the linked patients for a given partner account. Depending on what you want to achieve, you could loop trough those usernames and make a request for each one.

Anyway, thank you for your help.