Skip to main content
Question

API: DetailedSegmentEffort id does not match website segment effort id


Forum|alt.badge.img+2

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



 

2 replies

Jan_Mantau
Superuser
Forum|alt.badge.img+26
  • Superuser
  • 895 replies
  • April 6, 2023

That's not a problem with the Strava API, but with the JavaScript API you use. It seems to have problems with BigIntegers.


Forum|alt.badge.img+2
  • Author
  • Hub Rookie
  • 1 reply
  • April 7, 2023

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.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept, you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings