04-05-2023 10:43 AM - last edited on 07-06-2023 05:13 PM by LouB
Hello,
GET `activity` from the API includes `segment_efforts` array containing incorrect id values. They are all missing at least the last two digits.
I just started using this recently, and it seems like this is something people would have noticed already. Is it a new change?
example:
url of segment effort on Strava.com:
https://www.strava.com/activities/{activityId}/segments/XXXXXXXXXXXXXXXX336
what gets returned in API response:
{..., segment_efforts: [{id: XXXXXXXXXXXXXXXX300, ... }], ... }
note the last three digits in the URL: "336", and in the API response: "300"
This is for an identical segment effort, and can be repeated for every segment effort I tested
Calling API for GET segment_effort with id XXXXXXXXXXXXXXXX300 returns 404!
---
also calling GET segment_effort API with the correct id returns a result with the incorrect id.
---
DetailedSegmentEffort id says type is `long`
https://developers.strava.com/docs/reference/#api-models-DetailedSegmentEffort
Maybe this type does not have enough capacity to represent the full id as a number. Maybe it should return a string?
Found while using JavaScript API
04-06-2023 07:46 PM
Poked around some more, and it's definitely a JS issue. For anyone else hitting this limitation, you can try using the json-bigint npm package hooked into axios.
04-06-2023 03:07 AM
That's not a problem with the Strava API, but with the JavaScript API you use. It seems to have problems with BigIntegers.
Welcome to the Community - here is your guide to help you get started!