I am using Streaming API to get public posts stream specifically for this endpoint: POST statuses/filter.
I followed the exact steps & built my own code & now it is up & running. It delivers the expected results & streams to me the public statuses that contain the keyword I specify in the “track” parameter.
So at the beginning I had:
it worked fine.
Then I decided to search for posts having either Messi OR Ronaldo so I changed the “track” parameter to be:
it worked fine.
The problem appeared when I searched for posts having Messi AND Ronaldo:
it gives 401 authorization error.
Like always, I checked the OAuth tool for my app, & compare “Signature base string” generated by my code with the other one generated by OAuth tool. Strangely enough, Signature strings my code generates are exactly equal to the ones generated by OAuth tool. The Signature base string generated by both my code & the OAuth tool ends with:
The resulting HTTP request was rejected by Twitter. I played around a little bit, then I was shocked that Twitter accepted the HTTP request that was based on the same signature base string that instead ends with:
According to both “https://dev.twitter.com/docs/auth/creating-signature” & the OAuth tool, my parameter string should end with “&track=messi%20ronaldo”, which will result in a signature base string that ends with “%26track%3Dmessi%2520ronaldo” <-- This was exactly the same output I got from Twitter’s OAuth tool. & Strangely enough, this is what twitter rejected & gave me HTTP 401 error!
But when I changed my parameter string to end with “&track=messi ronaldo”, which is against Twitter’s documentation, this resulted in a signature base string ending with “%26track%3Dmessi%20ronaldo” <— which is against the output of OAuth tool… & Strangely enough, this is what Twitter accepted & started streaming me the statuses containing both Messi & Ronaldo !!! (Well, most of them were in favor of Messi, which helped improving my mood :D)
Any logical interpretation to this illogical situation?