White space not allowed error on An I/O error occurred sending to https://api.twitter.com/1.1/trends/place.json



Hello -I am getting a wierd error when making a Rest API call " An I/O error occurred sending to https://api.twitter.com/1.1/trends/place.json?id=23424977: white space not allowed"

I am using the bearer token for authentication (Application-only authentication)

Wondering if I can make the Trends API call using Application-only authentication or is it an issue with the GET request I am using above.

Thanks in advance.


That’s strange - I just tried this request using twurl (with a user token) and it completed successfully. Can you explain the steps or share the code you’re using? You should need to send anything, this is a GET request, so the error is a bit strange.


Sure. here are my parameters. Still getting the error…

End point: https://api.twitter.com/1.1/trends/place.json?id=23424977

HTTP Method: GET

Authorization : Bearer <BEARER TOKEN>
Content-Type : application/x-www-form-urlencoded;charset=UTF-8
User-Agent : app_name
Host: api.twitter.com
Accept-Encoding : gzip


Sorry Guys…i found the issue…The Content-Type had a space.

“Content-Type” <-- Right
"Content-Type " <-- Wrong


Ah, perfect, thanks for sharing the solution, and glad to know it is fixed for you now! :slight_smile: