"Param X is not an integer" error message from API

Hi,

I’m getting started with Python and with Twitch API and programmation. So my apology if my issue seems not like one to you.

I’m trying to send a GET Request with Python to retrieve a user’s followers.
Here is the function(short version) :

HEADERS = {'Client-ID': CLIENT_ID, 'Authorization': 'Bearer ' + OAUTH_TOKEN}
url = 'https://api.twitch.tv/helix/users/follows?to_id=174955366?first=100'
requests.get(url, headers=HEADERS)

Here is the response from Twitch API :
{'error': 'Bad Request', 'status': 400, 'message': 'Param 174955366?first=100 is not an integer.'}

I tried without ?first=100 and it worked.
I’m not sure what’s expected from me if I want to use ?first parameter.

Thank you.

The error is because you’re using the ? symbol twice.

In a querystring, you use ? once to indicate the start of the querystring, and then the ampersand & to indicate a split between the previous parameters value, and the next parameter.

So your URL should end with ?to_id=174955366&first=100

1 Like

Ohh, alright I get it. Thank you very much for your fast reply <3

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