15

Twitter has the ability as part of its API to query the current rate limit status. Going to this url will show you how many requests can be made before the limit is reached:

{"remaining_hits":150,  
 "hourly_limit":150,
 "reset_time_in_seconds":1274399014,
 "reset_time":"Thu May 20 23:43:34 +0000 2010"}

Requests to this url also do not count towards the limit.

Is there a similar ability with the SO API? If so, how is it done?

1
  • Should be tagged as feature-request. Commented Jun 7, 2010 at 12:49

1 Answer 1

13

I imagine a /status method would not be too hard, and is crucial in both testing and deploying applications.

Imagine an application that updates a database with new questions. It can query the /status method to correctly time it's calls so that it can make it through the day.

I would also consider whether this call should count towards the limit. Twitter, for instance, doesn't count a /status call against the limit.


Actually, it is included in all headers. From Chrome, here is what I get back:

Cache-Control:private
Connection:keep-alive
Content-Encoding:gzip
Content-Length:5158
Content-Type:application/json;
charset=utf-8 Date:Thu, 20 May 2010
23:18:10 GMT Server:nginx
X-AspNet-Version:2.0.50727
X-AspNetMvc-Version:2.0
X-RateLimit-Current:298
X-RateLimit-Max:300

4
  • I'd agree that it shouldn't count towards the limit, otherwise just simply asking if you are over the limit could put you over the limit :) Commented May 20, 2010 at 22:59
  • I thought that was the case.
    – Joel
    Commented May 21, 2010 at 0:03
  • I think that these RateLimit headers should be documented. Also, I believe that Twitter's API, for example, uses this header approach, as well as a /status method. Shouldn't we implement the latter, too (having /status not count against the rate limit, of course)? Commented May 21, 2010 at 17:52
  • 6
    I dislike the header method. I really think this should be added to /status as well.
    – Matt S.
    Commented May 25, 2010 at 22:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .