Hi,

Complete newbie here. Does anyone know of a good tutorial on how to retrieve tweets using curl from terminal? I have gone over the documentation pages but I am not making progress at all. Do I need to authenticate myself in order to retrieve tweets? If so, how do I go about it?

Thanks!

Yes, you need to add all the authentication headers - when starting out i wouldn’t recommend trying to do everything in curl, i’d use twurl instead - it’s like curl but does the OAuth stuff for you so you can get to grips with the API much easier: https://github.com/twitter/twurl not sure why all the examples aren’t in twurl in the docs tbh

1 Like

Thanks, @IgorBrigadir, for the quick response.

I have read about twurl but the thing is I have a test tomorrow about “using curl to interact with a RESTful API such as twitter” so I really need to get a basic understanding of curl…

If possible i’d pick a different API - curl is super awkward with Twitter OAuth, it needs a lot of manually generated headers that aren’t easy to do by hand (see https://developer.twitter.com/en/docs/basics/authentication/oauth-1-0a/creating-a-signature and https://developer.twitter.com/en/docs/basics/authentication/oauth-1-0a/authorizing-a-request), also you need to set timestamps and not be too late in issuing the call otherwise it times out. It’s a poor choice for learning basic curl usage, i’d use something like https://jsonplaceholder.typicode.com/ instead.

I would check stackoverflow https://stackoverflow.com/search?q=curl%20twitter curl questions and use explainshell.com to get a basic understanding of curl

:+1: Thanks!

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