TAGS :Viewed: 2 - Published at: a few seconds ago

[ Is there a way to check the Foursquare venue rate-limit without actually costing a request? ]

I am currently pinging the foursquare venue platform in order to harmonize my company's data with foursquare's. Information on the venue harmonization is here: https://developer.foursquare.com/overview/mapping

The rate limit is in the headers as X_RATELIMIT_REMAINING. I have a producer pushing out new requests and a consumer which touches the foursquare api. I would like to find out a way to have the producer check the rate limit without spending the remaining requests.

Does anyone know of a way to do this?

Answer 1


Unfortunately, there is no "dummy" enpoint to check your ratelimit. They have a multi endpoint but as far as I can remember they'll count each requests inside the batch.

You can count the ratelimit on your side. Here is an explanation :

The window should still update be updating in real time.

To be clear, if your rate limit is 500, at 11:00, you send 5 requests, the X-RateLimit-Remaining will be 495. If you wait a few minutes to 11:05, and send another request, X-Rate-Limit remaining will be 494 -- it won't have reset yet.

It's not until 12:01 that you'll get back the 5 requests that you'd made at 11:00. So, if you request again at 12:01, your limit would be 498 (-1 for the request you just did, -1 for the 11:05 request).

Requesting again at 12:06, and you'll be back up to 499 (the full limit, minus what you just used).

from this thread : API Quota exceeded

If you reproduce this logic and count each request you make per endpoint, you can guess your ratelimit. I'm sorry there is not an easier way to do this :(