mstuebner
Neuling
Posts: 7
Joined: Sat 13. Mar 2021, 16:06

Data via API adds to existing data for same date

Hi there,

I accidentally found that under certain circumstances data can be added, although for that date already exists.

When I insert mental data that already exists I get:

Code: Select all

Response 'Datapoint already exists' for mental status at 2021-04-09T06:00:00Z
Response 'Datapoint already exists' for mental status at 2021-04-10T06:00:00Z
When I added heartraterest data via api before, I get the same response:
Response 'Datapoint already exists' for heartrate rest at 2021-04-09T06:00:00Z
Response 'Datapoint already exists' for heartrate rest at 2021-04-10T06:00:00Z
That is different when data was already added via sync. When I then run the same code for the same date, I get the following response:
Response 'Datapoint successfully created' for heartrate rest at 2021-04-09T06:00:00Z
Response 'Datapoint successfully created' for heartrate rest at 2021-04-10T06:00:00Z
Only visible difference is, that the heartrate doesn't have a time when synced automatically, of course has one when I add data via api.
The existing data (from sync) is not overridden, the new data is just added, messing up the history.

So to me it seams that the check for existing data requires a time to be existing, but for some reasons the heartraterest that is synced from Garmin doesn't get a time assigned.

br Matthias
User avatar
mipapo
Administrator
Posts: 1576
Joined: Mon 29. Jul 2013, 20:26
Location: Kiel

Re: Data via API adds to existing data for same date

Mental state allows only one entry per day.
For resting heart rate we allow multiple entries per day, due to historical reasons, but we don't recommend it to add multiple per days as it doesn't make sense. And the check will always ignore the time.

So just disable the sync for Garmin resting heart rate, if you want to provide them via API.
###Become a Runalyze supporter###
- Nutzerhilfe/User help -

Run Happy!,
Michael
P.S. Ich antworte gerne kurz und knackig ;)
Image
mstuebner
Neuling
Posts: 7
Joined: Sat 13. Mar 2021, 16:06

Re: Data via API adds to existing data for same date

mipapo wrote: Sat 10. Apr 2021, 11:26 Mental state allows only one entry per day.
For resting heart rate we allow multiple entries per day, due to historical reasons, but we don't recommend it to add multiple per days as it doesn't make sense. And the check will always ignore the time.

So just disable the sync for Garmin resting heart rate, if you want to provide them via API.
I want to fill heartraterest only if there is no data from Garmin (why ever). Therefore I expected to get a "already" exist in cases where a heartrate is set already.

I didn't see and rest endpoint that allows me to test whether there is any heartraterest already set? Can I check that in a different way?

br Matthias
User avatar
mipapo
Administrator
Posts: 1576
Joined: Mon 29. Jul 2013, 20:26
Location: Kiel

Re: Data via API adds to existing data for same date

No sorry, there is no option for it
###Become a Runalyze supporter###
- Nutzerhilfe/User help -

Run Happy!,
Michael
P.S. Ich antworte gerne kurz und knackig ;)
Image

Return to “Personal API”