Bird
Raised Fist0

You receive these headers:

hard🚀 Application Q9 of Q15
Rest API - Rate Limiting and Throttling
You receive these headers:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 5
X-RateLimit-Reset: 1680007200

You want to display the time left until reset in minutes. How do you calculate it?
ASubtract Remaining from Limit and multiply by 60
BAdd X-RateLimit-Reset to current time and multiply by 60
CUse X-RateLimit-Limit divided by Remaining
DSubtract current Unix timestamp from X-RateLimit-Reset and divide by 60
Step-by-Step Solution
Solution:
  1. Step 1: Understand X-RateLimit-Reset as Unix timestamp

    This header gives the reset time in seconds since epoch.
  2. Step 2: Calculate time left

    Subtract current Unix timestamp from reset timestamp to get seconds left, then divide by 60 for minutes.
  3. Final Answer:

    Subtract current Unix timestamp from X-RateLimit-Reset and divide by 60 -> Option D
  4. Quick Check:

    Reset - now, then convert seconds to minutes [OK]
Quick Trick: Time left = (Reset - now) / 60 minutes [OK]
Common Mistakes:
MISTAKES
  • Adding instead of subtracting timestamps
  • Using limit or remaining counts incorrectly
  • Multiplying instead of dividing

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Rest API Quizzes