Kevin
Kevin

Reputation: 16033

What are the units for the time remaining value in GitHub's rate limiting message?

According to GitHub's API documentation, when you go over the rate limit, you get a response that looks like this:

HTTP/1.1 403 Forbidden
Date: Tue, 20 Aug 2013 14:50:41 GMT
Status: 403 Forbidden
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1377013266

{
    "message": "API rate limit exceeded for xxx.xxx.xxx.xxx. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)",
    "documentation_url": "https://developer.github.com/v3/#rate-limiting"
}

What are the units on the X-RateLimit-Reset value? In other words, how can I tell from the error message how long in seconds or minutes I need to wait before I can send another request?

Upvotes: 1

Views: 355

Answers (1)

uraimo
uraimo

Reputation: 19851

It's a Unix timestamp, see this note from the GitHub API documentation.

With the timestamp from that example the reset time would have been 20 Aug 2013 at 15:41:06.

According to a Wikipedia article the GitHub docs link to, a Unix timestamp is:

defined as the number of seconds that have elapsed since 00:00:00 Coordinated Universal Time (UTC), Thursday, 1 January 1970, not counting leap seconds.

Upvotes: 1

Related Questions