web-dev-qa-db-ja.com

HTTP APIレート制限HTTP応答ヘッダーの例

追加のHTTPステータスコードの1つ( RFC6585 )は

HTTP/RESTこのHTTP応答ステータスで役立つAPIレート制限HTTP応答ヘッダーの例はどこにありますか?

72
M8R-1jmw5r

HTTP APIレート制限HTTP応答ヘッダーの例を次に示します。 4つの一般的なREST API:Github、Vimeo、Twitter、Imgur:

Githubのレート制限 http://developer.github.com/v3/#rate-limited

#=============================#=============================================#
# 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-limited

#=============================#=============================================#
# 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-limited/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                                    |
+-----------------------------+---------------------------------------------+
116
M8R-1jmw5r

API固有のヘッダーに加えて、謙虚で標準的なRetry-Afterヘッダー。

24
Raedwald