TheQuantifyingStack icon indicating copy to clipboard operation
TheQuantifyingStack copied to clipboard

Oura v1 API Endpoints Removed

Open MarshalX opened this issue 2 years ago • 21 comments

Hi @phautamaki, thank you for your awesome work! Oura removed v1 API endpoints :(

The V1 API was removed on January 22nd, 2024.

We should migrate to v2 https://cloud.ouraring.com/v2/docs

MarshalX avatar Jan 23 '24 15:01 MarshalX

I’ve been searching Reddit this morning to see if anyone else was encountering issues, and it seems they are. I appreciate this shortcut so much, and would be so grateful if it could be updated? I wouldn’t know where to start but will be so happy if Petri posts an update.

nic-oura avatar Jan 24 '24 07:01 nic-oura

I fixed temperature sync and HRV & RHR sync. It wasn't a big effort but i dont want to maintain it so let's wait for the @phautamaki official fix. The major changes are:

  • access token must be passed in headers instead of query params
  • a lot of changes in JSON structure (inner object, renamed fields)
  • A 5min interval for HRV and RHR is still here but... It could be dynamic now (IG). we have a brand new field "interval" that we should respect
fixed temperature sync: image

MarshalX avatar Jan 24 '24 10:01 MarshalX

Cool that you've found a way to make the upgrade @MarshalX! Unfortunately, I have a lot of things going on at the moment, so I'm not sure when I'll be able to look into this. 😮‍💨

Out of curiosity: what are you doing with the temperature deviation information? I'm thinking should that be included in the shared shortcut also. 🤔

phautamaki avatar Jan 24 '24 12:01 phautamaki

Out of curiosity: what are you doing with the temperature deviation information? I'm thinking should that be included in the shared shortcut also. 🤔

ah sorry i thought that this shortcut was yours too xd ig it is mine based on some reddit's comment. sorry

im just doing 37 + temperatureDeviation and write to "Basal Body Temperature" which gives me a graphic of how it changes from time to time. i don't care about precise values

MarshalX avatar Jan 24 '24 13:01 MarshalX

Sadly this goes way over my head @MarshalX. Is there any chance you’d be able to share your fix?

nic-oura avatar Jan 24 '24 13:01 nic-oura

@nic-oura personally im using only "Sync Oura RHR & HRV (v2) " shortcut which runs automatically on closing of the "Oura" app. It doesn't support importing history or entering specific days. Only the current day. will it be enough for you?

MarshalX avatar Jan 24 '24 13:01 MarshalX

im just doing 37 + temperatureDeviation and write to "Basal Body Temperature" which gives me a graphic of how it changes from time to time. i don't care about precise values

Yes, I looked in to this sometime earlier but didn't implement support because the API only gives the deviation information. But in case you're not interested about precise values then that seems a reasonable thing to do.

phautamaki avatar Jan 24 '24 13:01 phautamaki

Hi @MarshalX thats exactly what I am using too, but didn’t actually realise it worked automatically on closing the app. I manually go into shortcuts each day and activate it! That’s how I noticed it wasn’t working. I’d be so grateful if you’re willing to share.

nic-oura avatar Jan 24 '24 13:01 nic-oura

Okay, there is the fixed version that also respects the new "interval" field. But pls don't ping me to fix it again or to tune it for your needs xd i just fixed it for myself

Sync Oura RHR & HRV.shortcut.zip. Pass your token to the "Text" field in case app will not ask you about your token.

It works completely silently and only notifies about successful imports. btw here is how to automate it on the "Oura" app closing:

press "Automation" at the bottom of the "Shortcuts" iOS app: image
create a new automation with the same params and pick the sync shortcut: image

MarshalX avatar Jan 24 '24 15:01 MarshalX

Really appreciate this, thank you @MarshalX and of course won’t ask again. I’ll try and learn how it works myself ahead of any further changes. Thanks again.

nic-oura avatar Jan 25 '24 06:01 nic-oura

Sadly the fix doesn’t work for me. Not sharing because I expect anyone to change it but to highlight in case anyone else joins the thread. It pulled in all HRV rather than just nighttime and so is disproportionately high. I think perhaps, for me, it’s time to give up on athlytic, which is a shame as I love the data but the complex shortcuts required will always be a bit too complicated for me. Thanks for your help @MarshalX and I’ll keep an eye out @phautamaki in case you get time to update. Take good care.

nic-oura avatar Jan 26 '24 07:01 nic-oura

On checking, it’s not pulling in the wrong data, it just didn’t work, for me. Although it seems to yesterday. I suspect this may be human error on my part. Apologies.

nic-oura avatar Jan 26 '24 07:01 nic-oura

Good morning! Today Oura recorded 2 sleep sessions (i didn't have a nap). And that session is sooooo weird. Duration about 40 min, lowest heart rate is 255 xdddd. so they have a problem.

and yeah, with such a strange data shortcut don't import it because it didn't originally support more than 1 sleep session (see the readme of this repo for more info).

but i added one more loop over sleep sessions in the shortcut and now it works with such strange cases.

moreover, it should support naps too but only if you will run a shortcut after taking a nap and don't run it after the main session

Sync Oura RHR & HRV.shortcut.zip

MarshalX avatar Jan 26 '24 09:01 MarshalX

Such a strange situation, shortcuts isn’t putting anything in Health for me, even with your new file… It’s very odd. I was awake for a long period in the early morning so perhaps somehow it’s prevented it from working properly due to the odd Oura data.

nic-oura avatar Jan 26 '24 09:01 nic-oura

Update: it did it! Thank you so much @MarshalX, if you have a Kofi account, let me know :)

nic-oura avatar Jan 26 '24 09:01 nic-oura

It creates duplicates in records. Probably need to fix the work with dates. It creates records again for the previous day

upd. i added one more if statement inside the loop through sleep sessions. compare "date" from JSON to the current date. works good

image

MarshalX avatar Jan 27 '24 11:01 MarshalX

Thanks @MarshalX, where did you add this, right at the end?

nic-oura avatar Jan 27 '24 14:01 nic-oura

Thanks @MarshalX, where did you add this, right at the end?

Sync Oura RHR & HRV.shortcut.zip

MarshalX avatar Jan 27 '24 14:01 MarshalX

Thanks @MarshalX! What is the best way to update this shortcut so that it works in timezones where the ISO 8601 timezone offset is negative? Similar to the ‘alternative’ shortcut design from @phautamaki. Trying to make what I think the necessary changes are myself, but am unable to edit. All of my HRV data for the previous night comes through as 12pm for the day I wake up in the apple health app.

babadabeep-lab avatar Jan 27 '24 16:01 babadabeep-lab

Thanks @MarshalX, I don’t see any duplicates but to be safe have used your update. So appreciative, thank you!

nic-oura avatar Jan 27 '24 19:01 nic-oura

@babadabeep-lab I just came across this repo and made an alternative version of the updated shortcut by @MarshalX to work with negative offset timezones. I’ll put it here for anyone who’s interested.

Sync Oura RHR & HRV (alternative).zip

cyberwool avatar Apr 03 '24 18:04 cyberwool