Skip to main content

Hi, I have an issue with Strava API. I want to get activity streams and especially cadence, watts and temp for 1 activity.

Problem: with my requests below, I can only see 'temp' and not cadence and watts.

header = {'Authorization': 'Bearer ' + access_token}
param = {'keys': ['cadence', 'watts', 'temp'], 'key_by_type': True}
time_list = requests.get(url, headers=header, params=param).json()

Does it mean we are able to do only 1 key per request ? Meaning I should have to do 3 requests and not only one ?

 

Thanks

Hey there, 


You should be able to make just the one request including all of the keys you're after. If you're running into issues making the request and receiving all of the data you're after, we recommend testing things out in the Swagger Playground. Always good to to ensure that the data is available per key for the specific activity you're querying. 

If you find you're still running into issues, do let us know! 


requests reads your params into the url as:

/?keys=cadence&keys=watts&keys=temp&keys_by_type=True

The Strava api is not flexible enough to take in params this way. It assumes that only one 'keys' query is made and thus only takes the last one in the query. Really they should add 'keys' as a Query method in their GET definition...

To make what you're asking for work:

keys = ['cadence', 'watts', 'temp']

keys =  ",".join(keys)

params = {'keys':keys,'key_by_type':True}

if you print keys it will look like this: 'cadence,watts,temp' and the query will be: '?keys=cadence,watts,temp&key_by_type=True


Reply