HTTP API速率限制HTTP响应头的示例
其中一个额外的HTTP状态码( RFC6585 )是
- 429太多的请求
我在哪里可以find对HTTP响应状态有用的HTTP / REST API速率限制HTTP响应头的示例?
以下是HTTP API速率限制HTTP响应标头的一些示例。 来自四个常见的REST API:Github,Vimeo,Twitter和Imgur:
Github费率限制http://developer.github.com/v3/#rate-limiting
#=============================#=============================================# # HTTP Header # Description # #=============================#=============================================# | X-RateLimit-Limit | Request limit per hour | +-----------------------------+---------------------------------------------+ | X-RateLimit-Remaining | The number of requests left for the time | | | window | +-----------------------------+---------------------------------------------+
Vimeo速率限制http://developer.vimeo.com/guidelines/rate-limiting
#=============================#=============================================# # HTTP Header # Description # #=============================#=============================================# | X-RateLimit-Limit | Request limit per day / per 5 minutes | +-----------------------------+---------------------------------------------+ | X-RateLimit-Remaining | The number of requests left for the time | | | window | +-----------------------------+---------------------------------------------+ | X-RateLimit-Reset | The remaining window before the rate limit | | | resets in UTC epoch seconds | +-----------------------------+---------------------------------------------+
Twitter的REST API速率限制https://dev.twitter.com/docs/rate-limiting/1.1
注意: Twitter使用类似Vimeo这样的名称,但在每个名称中都有另一个短划线。
#=============================#=============================================# # HTTP Header # Description # #=============================#=============================================# | X-Rate-Limit-Limit | The rate limit ceiling for that given | | | request | +-----------------------------+---------------------------------------------+ | X-Rate-Limit-Remaining | The number of requests left for the | | | 15 minute window | +-----------------------------+---------------------------------------------+ | X-Rate-Limit-Reset | The remaining window before the rate limit | | | resets in UTC epoch seconds | +-----------------------------+---------------------------------------------+
Imgur API比率限制http://api.imgur.com/
#=============================#=============================================# # HTTP Header # Description # #=============================#=============================================# | X-RateLimit-UserLimit | Total credits that can be allocated | +-----------------------------+---------------------------------------------+ | X-RateLimit-UserRemaining | Total credits available | +-----------------------------+---------------------------------------------+ | X-RateLimit-UserReset | Timestamp (unix epoch) for when the credits | | | will be reset | +-----------------------------+---------------------------------------------+ | X-RateLimit-ClientLimit | Total credits that can be allocated for the | | | application in a day | +-----------------------------+---------------------------------------------+ | X-RateLimit-ClientRemaining | Total credits remaining for the application | | | in a day | +-----------------------------+---------------------------------------------+
除了API特定的标题之外,不要忘记标准的Retry-After
标题。