🚨 Pay Just $95/Year (Save 50%)—Black Friday Deal!

#132 API Analytics and Rate Limiting

15/05/2023
rails api api development rate limiting api usage tracking

If you don’t limit your API usage, bad users can DDOS your server.
If you don’t track API usage, how do you know if it is even used?
Apps like Twitter and Shopify have daily or monthly (30-day) API usage limits
In this tutorial we will track API usage per user and add a 30-day max limit of API requests per user.

Learn the best practices from Shopify API and Twitter API!

Episode source code: https://github.com/corsego/132-api-request-tracking-limiting/commit/92812d49c4ff7666850a1b0bf7821143f811f614
Based on this blogpost: https://blog.corsego.com/api-usage-tracking-rest-rate-limiting

0:00 Overview of current API app
2:35 Why Track API usage
3:50 ApiRequest model
4:52 Log ApiRequests
7:10 Limit API requests
11:25 Display API call limit in header
15:27 Track API key usage

0
Inicia sesión para unirte a la conversación
Sign in to access PRO lessons, access private repos, leave comments, create watch lists.
We collect your email address, name and username to create your account. We do not share your email address with anyone else.