I’m getting some strange behaviour when testing the Standard Search API. I’ve set up Postman and can successfully get a response on every API, however when I try to query this example uri:
https://api.twitter.com/1.1/search/tweets.json?q=from%3Atwitterdev&result_type=mixed&count=2
I get the following response:
{
"errors": [
{
"code": 32,
"message": "Could not authenticate you."
}
]
}
What makes this even more odd is that if I remove the search operators I do get a response:
For example: https://api.twitter.com/1.1/search/tweets.json?q=twitterdev returns 15 tweets.
I’ve also created two separate apps and can verify that I get the same behaviour on both.
Could someone advise me on what the issue could be? I’ve searched through everything and am really lost. Thank you
This one seems like it’s an issue with URL encoding : in the from:twitterdev query.
Most likely the OAuth signature base string https://developer.twitter.com/en/docs/basics/authentication/guides/creating-a-signature.html
I don’t like using Postman for this kind of stuff because i’ve always had problems like this when getting it to work, but that’s just my personal gripe with it. I use twurl for tests
Thanks for your reply IgorBrigadir. I’ve set up twurl, however I still can’t query the search api. I tried the example in the docs page (twurl /1.1/search/tweets.json?q=from%3Atwitterdev&result_type=mixed&count=2).
However I get:
parse error near '&'.
I also tried queries with other users. For example:
twurl /1.1/search/tweets.json?q=%40BillGates, results in:
no matches found: /1.1/search/tweets.json?q=%40BillGates
Other api queries e.g. twurl /1.1/statuses/home_timeline.json sends out correct json. I’m really confused.
that might be the command line breaking up the command, try it with ""
twurl "/1.1/search/tweets.json?q=from%3Atwitterdev&result_type=mixed&count=2"
That works for me
1 Like
Thanks so much Igor! This did the trick indeed!
system
closed
#6
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.