Playing with the Twitter API for the first time


With Christmas break in between my classes at Regis, I decided to do a little more playing on my own. I’ve decided to poke at the Twitter REST API since I use Twitter a ton and have some issues with how it works. Creating my own app that references the Twitter API can solve my problems If I can figure out how to use it.

My Twitter issues have to do with the “Twitter ceiling”, a magical ratio that gets to decide how many people we get to follow. I’ve had my Twitter account since 2008, so I’ve followed a ton of people for various reasons. Lately I have been using Twitter to follow people involved in the Colorado tech community and there’s a LOT of people involved in the Colorado tech community. Since I’m at the ceiling of following 2001 accounts I need a way to manage the accounts that I’m following. I’ve started using lists for different types of accounts. I have an Avalanche list for Avalanche fans, a News list for local breaking news reporters and a Colorado Tech list to keep up with the people I want to follow on Twitter when I can’t just follow them. It’s a messy way to organize since Twitter doesn’t seem to place a lot of importance on lists. So here are my 2 solutions to my problem:

  • Stop following dormant accounts – I bet there’s an account I followed 3 years ago who hasn’t said anything in 2 years but the account hasn’t closed. There’s no point in following someone who doesn’t say anything. I will make an app to show me the dormant accounts that I’m following.
  • Better manage my lists – I like using lists in Twitter. Sometimes it’s the only thing that tells me why I’m following an account. If I’m following an account and I don’t have that account in a list it either means I’m not interested in that account anymore or it hasn’t said anything. By finding out which accounts are in which lists I can better manage them. I will make an app to show me which accounts are in which lists and whether or not I am following those accounts.

The entire reason I started learning Ruby was because of the Twitter API tutorial on Codecademy which is a pretty damn awesome tutorial. It tells you all about RESTful APIs, http requests and responses before even touching Twitter. These are some super important things to know when using APIs. I’ll be writing a post about those things shortly just for reference.

Anyway I went back to that tutorial, copied some of the code from one of the examples and started squishing code around to find out which accounts I’m following have gone dormant. Version 1 will just be a Ruby command-line app that shows the username and date of last tweet for accounts that haven’t tweeted in over a month. I’m better at making things work than making things easy to use. Here’s where I’m at so far…

  • Rate limits are unforgiving. I made a loop that made requests of the Twitter API on each iteration, but forgot to exit the loop. I had to wait 15 minutes to try again.
  • Authentication is confusing. Tokens baffle me. I need to get more comfortable with this.
  • I’ve hit a wall (which is why I’m blogging right now and not coding).  I’m using the GET friends/list functionality of the API. It tells me it returns “pages” of results that can have up to 200 users per page. I’ve learned how to use cursors to retrieve the next “page” but for some reason no matter how many users I request per “page” I only get 45 total users before Ruby gets mad at me for attempting to call a method on a nil object which confuses me.
    • I wonder if my weird 45 user limit has to do with my misunderstanding of OAuth.
    • Maybe I should try using the GET friends/ids part of the API, but I’m not sold on this idea. I’d rather get the whole friend object instead of just ids.

Now that I’ve typed through my wall, I’m gonna go back to squishing code. If you know what I’m doing wrong, please let me know.

Dev News Weekly #3: All the big names doing all the big things

Dev News Weekly is designed to give you (and me) 10 useful software/web developer stories every Tuesday morning!

Satya Nadella laid out his vision for Microsoft this week. I like “productivity and platform” over “software and services”. “Software and services” sounds like “stuff and junk” just without the cool alliteration. Apple showed transparency with Swift. Amazon showed off some new AWS services and Google released a cross-platform SDK! I feel like I’m cheating at SEO but this all really did happen this week.

Developer News

  • Apple opens up with a new blog about Swift, its new programming language [TechCrunch]
  • App developers gain resource hub, search engine to build the future [MediaPost]
  • Microsoft is a ‘productivity and platform company’ now, Nadella says [VentureBeat]
  • Software developers rank ALM tools as best to use [eWeek]
  • Game of Code: Checkio gamifies and crowdsources the task of programming [VentureBeat]
  • Apigee initiates global API challenge [ProgrammableWeb]
  • Python is now the most popular introductory teaching language at top U.S. universities [ACM]
  • Amazon courts mobile devs with a new suite of AWS services [VentureBeat]
  • Google Updates Android’s Play Games and Cross-Platform SDKs [ProgrammableWeb]
  • New Raspberry Pi “B+” uses less power, has more USB ports [ArsTechnica]

Pick of the Week

I needed to have something else in these posts besides my usual blathering and 10 news stories, so I will choose one thing each week to promote just because I like it.

My last 2 picks have been podcasts so I felt the need to change it up. This week my pick is For too long I said “I want to be a developer” without having an answer to the question “What kind of developer?” Codecademy allowed me to try out a language without too much overhead, actually without any overhead! It’s all on their site. If you want to check out a new web programming language, give them a visit!

Thank you for reading!

If you know of any other good news sources for developers (especially newbies like me), please let me know!

You can subscribe to all my posts by email!