How best to determine club id?

866 views
Skip to first unread message

Lou King

unread,
Jan 14, 2016, 11:05:19 AM1/14/16
to Strava API
I had set up some code to use the strava api a while ago (Sept 2015) which I'd tested and it seemed to work.

I think it used to be that the api used the same slug for club that the web page used. I.e., I think I used to be able to retrieve from https://www.strava.com/api/v3/clubs/fsrc/activities?access_token=<obscured>&per_page=200&page=1 for when I could use the URL https://www.strava.com/clubs/fsrc

But now instead of a club slug "fsrc", the api seems to be looking for an integer id. I get an error result and the API document seems to indicate the integer id is now required: {"resource":"Club","field":"id","code":"invalid"}

To determine the id of my club I clicked edit and I do see an id 18929 -- is this the only way to determine my club id or is there some way using the slug on the api?

Any advice would be appreciated.

Seems odd that the semantics of this were changed -- not sure why the slug access was eliminated.

Chris Donahue

unread,
Jan 14, 2016, 1:03:29 PM1/14/16
to Lou King, Strava API
You can get the clubs that the authenticated athlete belongs to using http://strava.github.io/api/v3/clubs/#get-athletes. This will return an array of clubs, including the club's ID.

- Chris Donahue (Strava Engineer)

--
You received this message because you are subscribed to the Google Groups "Strava API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to strava-api+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Lou King

unread,
Jan 14, 2016, 1:24:16 PM1/14/16
to Strava API, lous...@gmail.com
Yes this works. 

A shame it returns the club name but not what I'm calling the "slug" part of the vanity url. I don't see the slug is available when calling http://strava.github.io/api/v3/clubs/#get-details either.

And looking at some of the comments in the code I'd written 4 months ago, I think I may have been wrong that the slug was used in a previous iteration -- I guess that's just how I think it *should* work, not how the documentation *says* it works.

;)

But I'm good for now. Thanks for your quick response.
Reply all
Reply to author
Forward
0 new messages