Hi I’m having a problem when posting a tweet with line breaks inside.

The response sends error code 32 : could not authenticate you.
I am using Postman and my request is POST https://api.twitter.com/1.1/statuses/update.json?status=This is my tweet%0Aon two lines
The same happened with %20 instead of white spaces.

I tried using \n and \r\n in the status parameter, it just posted “This is my tweet\non two lines”, so my authentication is correct, but the result is unexpected.

I don’t know if it’s a bug, if I am not allowed to add line breaks in tweets, or if I am just doing things wrong :man_shrugging:… Still, the response is a bit strange, as I know that my credentials are ok…

This depends entirely on how the call is made - in what language / library. If the code incorrectly % encodes the request url given the tweet text, you will get this error, because the OAuth signature won’t match.

thanks for answering :slight_smile:
I am using Postman which is a software to make calls.
It simplifies things like authentication and parameters.

I don’t think it changes my parameters in any way, so maybe I should use another line break symbol ? (\n didn’t work, I don’t know any other)

There’s probably a way in postman you can do this - you may have to manually do something to specify an escape character. I don’t like using it for stuff like this because errors like the one you got are too easy to make.

I’d suggest trying calls in twurl GitHub - twitter/twurl: OAuth-enabled curl for the Twitter API or even better, a twitter specific library like GitHub - geduldig/TwitterAPI: Minimal python wrapper for Twitter's REST and Streaming APIs

Thanks, I solved my problem with Postman, I was using parameters, when i should be using x-www-form-urlencoded body.
In my settings, I set “Trim keys and values in request body” to ‘On’

I am developing a Flutter app, and it doesn’t provide a twitter specific library, I’m going to see if the library I am using provides a way to do this

1 Like

Ah, i didn’t know about flutter, but it looks like there’s already a library for twitter API calls? twitter | Dart Package i’d try to use that or another OAuth library to manage calls.

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