レート制限
REST API を使って、現在のレート制限の状態を確認します。
レート制限について
現在のレート制限の状態はいつでも確認できます。 レート制限規則について詳しくは、「REST API のリソース」をご覧ください。
アイテムを検索するための REST API には、他の REST API エンドポイントを管理するレート制限とは別のカスタム レート制限があります。 詳しくは、「search」をご覧ください。 GraphQL API にも、REST API のレート制限とは別の、別の方法で計算されるカスタム レート制限があります。 詳しくは、「リソースの制限」をご覧ください。 そのため、API の応答は、レート制限を分類します。 resources
の下には、次のようなさまざまなカテゴリに関連するオブジェクトが表示されます。
-
core
オブジェクトは、REST API の検索に関連しないすべてのリソースに関するレート制限の状態を示します。 -
search
オブジェクトは、REST API の検索に関するレート制限の状態を示します。 -
graphql
オブジェクトは、GraphQL API のレート制限の状態を示します。 -
integration_manifest
オブジェクトは、POST /app-manifests/{code}/conversions
操作のレート制限の状態を示します。 詳しくは、「マニフェストから GitHub アプリを作成する」をご覧ください。
レート制限の応答のヘッダーと値の詳細については、「Resources in the REST API」 (REST API のリソース) を参照してください。
Get rate limit status for the authenticated user
Note: Accessing this endpoint does not count against your REST API rate limit.
Note: The rate
object is deprecated. If you're writing new API client code or updating existing code, you should use the core
object instead of the rate
object. The core
object contains the same information that is present in the rate
object.
HTTP 応答状態コード
状態コード | 説明 |
---|---|
200 | OK |
304 | Not modified |
404 | Resource not found |
コード サンプル
curl \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
http(s)://HOSTNAME/api/v3/rate_limit
Response
Status: 200
{
"resources": {
"core": {
"limit": 5000,
"remaining": 4999,
"reset": 1372700873,
"used": 1
},
"search": {
"limit": 30,
"remaining": 18,
"reset": 1372697452,
"used": 12
},
"graphql": {
"limit": 5000,
"remaining": 4993,
"reset": 1372700389,
"used": 7
},
"integration_manifest": {
"limit": 5000,
"remaining": 4999,
"reset": 1551806725,
"used": 1
},
"code_scanning_upload": {
"limit": 500,
"remaining": 499,
"reset": 1551806725,
"used": 1
}
},
"rate": {
"limit": 5000,
"remaining": 4999,
"reset": 1372700873,
"used": 1
}
}