PHP-Instagram-API icon indicating copy to clipboard operation
PHP-Instagram-API copied to clipboard

Add response headers to ApiResponse to gather API limits information

Open athlan opened this issue 12 years ago • 4 comments

ApiResponse has been modified, headers has been stored.

Use getRateLimit() and getRateLimitRemaining() from ApiResponse to get info about current API usage.

athlan avatar Sep 25 '13 14:09 athlan

Can you show an example of how this can be utilizied?

galen avatar Sep 30 '13 21:09 galen

Of course. Our service using this library often reaches Instagram's limits so we have to switch API keys by round-robin or read these limits. We also generates the alerts if API client will soon reach limits based on header information (not hardcoded value).

athlan avatar Sep 30 '13 21:09 athlan

I mean in code. Can you show me how you use it?

On Sep 30, 2013, at 5:44 PM, Piotr Pelczar [email protected] wrote:

Of course. Our service using this library often reaches Instagram's limits so we have to switch API keys by round-robin or read these limits. We also generates the alerts if API client will soon reach limits based on header information (not hardcoded value).

— Reply to this email directly or view it on GitHub.

galen avatar Sep 30 '13 22:09 galen

I just implemented this without looking at the open PR's, but I did it a little differently. Having it hang off the response isn't very useful to the client. I'll pull and open a PR.

mpatnode avatar Oct 10 '14 22:10 mpatnode