Multiple user_ids in streams endpoint

I’m trying to use the streams endpoint to get multiple stream information using only one request. According to documentation I can specify up to 100 ids in my request.
I’m using python with requests lib:

url = ‘
headers = {‘Client-ID’: client_id’, ‘Authorization’:'Bearer '+access_token}
payload = {‘user_id’:‘user1’,‘user_id’:‘user2’…}
r = requests.get(url,params=payload, headers=headers)

Using the above code the endpoint returns only one result, corresponding to the last user_id specified in payload param, During my testing I made sure to request user ids of live streams

What’s the correct syntax to get mutliple results ?

Thank You

The correct URL construction is

You might have to use not params and string concantenate the URL instead

payload = {‘user_id’:‘user1’,‘user_id’:‘user2’…}

Creates and object of only on entry

payload = {‘user_id’:[‘user1’,‘user2']}

Make work but I’d not to familair with Python.

So building the URL manually instead of using params might be the way to go

Hi BarryCarlyon

Using payload = {‘user_id’:[‘user1’,‘user2’]} works !

Thank you

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.