Ajax-loader-large-white
Introduction to Twitter's API
Reading a Tweet

This exercise introduces the /1.1/statuses/show.json endpoint, which returns data for a Tweet, given its ID number.

We introduce the idea of passing parameters in your GET request by creating a Hash of key/value pairs, and then encoding it into the URL with URI.encode_www_form.

Instructions

First, change the id parameter of the request to load the Tweet with ID 266270116780576768.

Second, print that Tweet on a single line in the following format "USERNAME - TWEET_TEXT".

?
Stuck? Get a hint! Hint
Get live, fast support from Codecademy Advisors when you get stuck. Learn more.

Try using

puts JSON.pretty_generate(tweet)

to dump the Tweet structure, to see which fields are available.

The screen name of the user can be accessed through tweet["user"]["name"].

The text of the Tweet can be accessed through tweet["text"].

script.rb