DZone
IoT Zone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
  • Refcardz
  • Trend Reports
  • Webinars
  • Zones
  • |
    • Agile
    • AI
    • Big Data
    • Cloud
    • Database
    • DevOps
    • Integration
    • IoT
    • Java
    • Microservices
    • Open Source
    • Performance
    • Security
    • Web Dev
DZone > IoT Zone > Amateur Radio Homebrew (Part 2): Understanding Twitter’s API Rate Limits

Amateur Radio Homebrew (Part 2): Understanding Twitter’s API Rate Limits

As we continue to work on our homemade radio, while integrating Twitter, let's dive into Twitter's REST API and rate limiting and how work with both of them.

Kevin Hooke user avatar by
Kevin Hooke
·
May. 05, 17 · IoT Zone · Tutorial
Like (0)
Save
Tweet
4.67K Views

Join the DZone community and get the full member experience.

Join For Free

Here's a quick update on my project to build an Amateur Radio Packet to Twitter bridge (see here for the first post).

I’ve moved the Node.js code to a Raspberry Pi 3. So far I have up and running:

  • OAUTH authentication with Twitter (covered in my first post)
  • Installed Node.js on the Raspberry Pi
  • Parsing ax25 Packets read from the TNC-Pi using node.js ax25 library
  • MongoDB running on the Raspberry Pi
  • Partially implemented duplicate post detection/rate limiting

Twitter provides an incredibly useful REST-based API to integrate with their service, but understandably, your usage is ‘rate limited’ so you’re not retrieving vast amounts of data or flooding the service with spam Tweets.

To understand their rate limit approach, see this article.

For limits on POSTs, for example for creating new Tweets, you can check this out. 

As per the above article, POSTs are limited 2,400 per day, or 100/hour. This means that if your app could potentially use the POST APIs more often than 100 times per hour, you need to build some limiting logic into your app so you don’t exceed this threshold.

The rate limits for the /GET REST APIs are here, although, for my application, I’m not relying heavily on GETs — the majority of the calls are POSTS.

Twitter’s API prevents you from posting duplicate Tweets (see here), although they don’t publish how much time needs to elapse before an identical post is no longer consider a duplicate (see here). This wasn’t something I was planning on handling, but given the repetitive nature of some packet transmissions, BEACON packets for example, and packets sent for ID, this has to be a necessary feature of my app. Otherwise, in the worst case, it would be attempting to tweet a station's BEACON packet every minute continuously.

To handle this, I’m storing each Tweet sent with additional tracking stats, like the time the last tweet was sent. Using this timestamp, I can then calculate the elapsed time between now and the time the last tweet was sent to make sure enough time has elapsed before I attempt to Tweet the packet again.

This is still a work in progress and there’s still some tweaking to do on the duplicate post detection and rate limiting, but while testing, you can see the tweets sent from my Twitter account @KK6DCT_Packet.

Here’s an example of the packets currently being tweeted:

Image title

API twitter Homebrew (video games)

Published at DZone with permission of Kevin Hooke, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Top 10 Automated Software Testing Tools
  • Modern Application Security Requires Defense in Depth
  • Practice on Pushing Messages to Devices of Different Manufacturers
  • Getting Started With RSocket Kotlin

Comments

IoT Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • MVB Program
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends:

DZone.com is powered by 

AnswerHub logo