Bookmark and Share


Get sample JSON data

We'll get some sample JSON data by using cURL to call Twitter's API.

2014 March

As of 2014 March Twitter API v1.1, the following method works.

  1. Go to Twitter app's home page and make a testing app such as,
  2. click on the "Test OAuth" button to see various authentication metadata,
  3. click on "See OAuth signature for this request" button, and see more specialized authentication data, including a directly usable temporary cURL command for the RESTful request.

As an example

curl \
--get '' \
--data 'count=2&screen_name=twitterapi' \
--header 'Authorization: \
OAuth oauth_consumer_key="Iie5pLbQHTcvsNSL4Q9bQ", \
oauth_nonce="5ae19d9143cfec50b3990e19e8863b21", \
oauth_signature="NROfqSHW1BLMFwK8ePbZQfLzwaI%3D", \
oauth_signature_method="HMAC-SHA1", \
oauth_timestamp="1395206578", \
oauth_token="14663976-CN3V54WoIXzofcn697ooLjDRaNuHS0ZiEFLCMDyK4", \
oauth_version="1.0"' \
--verbose \
> twitter-api-get-output.json

obtains JSON data twitter-api-get-output.json.

Note this exact call is only valid for a few minutes after it was first created.

Example jq queries

Get all values of text:

$ cat twitter-api-get-output.json | jq '.[].text'
"Broadcasting the voices of WordPress users, one Tweet at a time"
"RT @crashlytics: Announcing Crashlytics Labs Project: Beta Distribution #androiddev #iosdev"
blog comments powered by Disqus