REST-API-Endpunkte für API Insights
Verwende die REST-API, um Statistiken für die API-Verwendung in einer Organisation anzuzeigen.
Get route stats by actor
Get API request count statistics for an actor broken down by route within a specified time frame.
Differenzierte Zugriffstoken für "Get route stats by actor"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get route stats by actor“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
actor_type string ErforderlichThe type of the actor Kann eine der Folgenden sein: |
actor_id integer ErforderlichThe ID of the actor |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
direction string The direction to sort the results by. Standard: Kann eine der Folgenden sein: |
sort array The property to sort the results by. |
HTTP-Antwortstatuscodes für „Get route stats by actor“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get route stats by actor“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/route-stats/ACTOR_TYPE/ACTOR_ID?min_timestamp=MIN_TIMESTAMP"
Response
Status: 200
[
{
"http_method": "GET",
"api_route": "/repositories/:repository_id",
"total_request_count": 544665,
"rate_limited_request_count": 13,
"last_request_timestamp": "2024-09-18T15:43:03Z",
"last_rate_limited_timestamp": "2024-09-18T06:30:09Z"
}
]
Get subject stats
Get API request statistics for all subjects within an organization within a specified time frame. Subjects can be users or GitHub Apps.
Differenzierte Zugriffstoken für "Get subject stats"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get subject stats“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
direction string The direction to sort the results by. Standard: Kann eine der Folgenden sein: |
sort array The property to sort the results by. |
HTTP-Antwortstatuscodes für „Get subject stats“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get subject stats“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/subject-stats?min_timestamp=MIN_TIMESTAMP"
Response
Status: 200
[
{
"subject_type": "installation",
"subject_id": 954453,
"subject_name": "GitHub Actions",
"integration_id": 124345,
"total_request_count": 544665,
"rate_limited_request_count": 13,
"last_request_timestamp": "2024-09-18T15:43:03Z",
"last_rate_limited_timestamp": "2024-09-18T06:30:09Z"
}
]
Get summary stats
Get overall statistics of API requests made within an organization by all users and apps within a specified time frame.
Differenzierte Zugriffstoken für "Get summary stats"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get summary stats“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
HTTP-Antwortstatuscodes für „Get summary stats“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get summary stats“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/summary-stats?min_timestamp=MIN_TIMESTAMP"
Response
Status: 200
{
"total_request_count": 34225,
"rate_limited_request_count": 23
}
Get summary stats by user
Get overall statistics of API requests within the organization for a user.
Differenzierte Zugriffstoken für "Get summary stats by user"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get summary stats by user“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
user_id string ErforderlichThe ID of the user to query for stats |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
HTTP-Antwortstatuscodes für „Get summary stats by user“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get summary stats by user“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/summary-stats/users/USER_ID?min_timestamp=MIN_TIMESTAMP"
Response
Status: 200
{
"total_request_count": 34225,
"rate_limited_request_count": 23
}
Get summary stats by actor
Get overall statistics of API requests within the organization made by a specific actor. Actors can be GitHub App installations, OAuth apps or other tokens on behalf of a user.
Differenzierte Zugriffstoken für "Get summary stats by actor"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get summary stats by actor“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
actor_type string ErforderlichThe type of the actor Kann eine der Folgenden sein: |
actor_id integer ErforderlichThe ID of the actor |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
HTTP-Antwortstatuscodes für „Get summary stats by actor“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get summary stats by actor“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/summary-stats/ACTOR_TYPE/ACTOR_ID?min_timestamp=MIN_TIMESTAMP"
Response
Status: 200
{
"total_request_count": 34225,
"rate_limited_request_count": 23
}
Get time stats
Get the number of API requests and rate-limited requests made within an organization over a specified time period.
Differenzierte Zugriffstoken für "Get time stats"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get time stats“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
timestamp_increment string ErforderlichThe increment of time used to breakdown the query results (5m, 10m, 1h, etc.) |
HTTP-Antwortstatuscodes für „Get time stats“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get time stats“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/time-stats?min_timestamp=MIN_TIMESTAMP×tamp_increment=TIMESTAMP_INCREMENT"
Response
Status: 200
[
{
"timestamp": "2024-09-11T15:00:00Z",
"total_request_count": 34225,
"rate_limited_request_count": 0
},
{
"timestamp": "2024-09-11T15:05:00Z",
"total_request_count": 10587,
"rate_limited_request_count": 18
},
{
"timestamp": "2024-09-11T15:10:00Z",
"total_request_count": 43587,
"rate_limited_request_count": 14
},
{
"timestamp": "2024-09-11T15:15:00Z",
"total_request_count": 19463,
"rate_limited_request_count": 4
},
{
"timestamp": "2024-09-11T15:20:00Z",
"total_request_count": 60542,
"rate_limited_request_count": 3
},
{
"timestamp": "2024-09-11T15:25:00Z",
"total_request_count": 55872,
"rate_limited_request_count": 23
}
]
Get time stats by user
Get the number of API requests and rate-limited requests made within an organization by a specific user over a specified time period.
Differenzierte Zugriffstoken für "Get time stats by user"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get time stats by user“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
user_id string ErforderlichThe ID of the user to query for stats |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
timestamp_increment string ErforderlichThe increment of time used to breakdown the query results (5m, 10m, 1h, etc.) |
HTTP-Antwortstatuscodes für „Get time stats by user“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get time stats by user“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/time-stats/users/USER_ID?min_timestamp=MIN_TIMESTAMP×tamp_increment=TIMESTAMP_INCREMENT"
Response
Status: 200
[
{
"timestamp": "2024-09-11T15:00:00Z",
"total_request_count": 34225,
"rate_limited_request_count": 0
},
{
"timestamp": "2024-09-11T15:05:00Z",
"total_request_count": 10587,
"rate_limited_request_count": 18
},
{
"timestamp": "2024-09-11T15:10:00Z",
"total_request_count": 43587,
"rate_limited_request_count": 14
},
{
"timestamp": "2024-09-11T15:15:00Z",
"total_request_count": 19463,
"rate_limited_request_count": 4
},
{
"timestamp": "2024-09-11T15:20:00Z",
"total_request_count": 60542,
"rate_limited_request_count": 3
},
{
"timestamp": "2024-09-11T15:25:00Z",
"total_request_count": 55872,
"rate_limited_request_count": 23
}
]
Get time stats by actor
Get the number of API requests and rate-limited requests made within an organization by a specific actor within a specified time period.
Differenzierte Zugriffstoken für "Get time stats by actor"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get time stats by actor“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
actor_type string ErforderlichThe type of the actor Kann eine der Folgenden sein: |
actor_id integer ErforderlichThe ID of the actor |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
timestamp_increment string ErforderlichThe increment of time used to breakdown the query results (5m, 10m, 1h, etc.) |
HTTP-Antwortstatuscodes für „Get time stats by actor“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get time stats by actor“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/time-stats/ACTOR_TYPE/ACTOR_ID?min_timestamp=MIN_TIMESTAMP×tamp_increment=TIMESTAMP_INCREMENT"
Response
Status: 200
[
{
"timestamp": "2024-09-11T15:00:00Z",
"total_request_count": 34225,
"rate_limited_request_count": 0
},
{
"timestamp": "2024-09-11T15:05:00Z",
"total_request_count": 10587,
"rate_limited_request_count": 18
},
{
"timestamp": "2024-09-11T15:10:00Z",
"total_request_count": 43587,
"rate_limited_request_count": 14
},
{
"timestamp": "2024-09-11T15:15:00Z",
"total_request_count": 19463,
"rate_limited_request_count": 4
},
{
"timestamp": "2024-09-11T15:20:00Z",
"total_request_count": 60542,
"rate_limited_request_count": 3
},
{
"timestamp": "2024-09-11T15:25:00Z",
"total_request_count": 55872,
"rate_limited_request_count": 23
}
]
Get user stats
Get API usage statistics within an organization for a user broken down by the type of access.
Differenzierte Zugriffstoken für "Get user stats"
Dieser Endpunkt funktioniert mit den folgenden differenzierten Tokentypen.:
- GitHub-App-Benutzerzugriffstoken
- Zugriffstoken für GitHub App-Installation
- Differenzierte persönliche Zugriffstoken
Das differenzierte Token muss einen der folgenden Berechtigungssätze aufweisen.:
- "API Insights" organization permissions (read)
Parameter für „Get user stats“
Name, type, BESCHREIBUNG |
---|
accept string Setting to |
Name, type, BESCHREIBUNG |
---|
org string ErforderlichThe organization name. The name is not case sensitive. |
user_id string ErforderlichThe ID of the user to query for stats |
Name, type, BESCHREIBUNG |
---|
min_timestamp string ErforderlichThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: |
max_timestamp string The maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: |
page integer The page number of the results to fetch. For more information, see "Using pagination in the REST API." Standard: |
per_page integer The number of results per page (max 100). For more information, see "Using pagination in the REST API." Standard: |
direction string The direction to sort the results by. Standard: Kann eine der Folgenden sein: |
sort array The property to sort the results by. |
HTTP-Antwortstatuscodes für „Get user stats“
Statuscode | BESCHREIBUNG |
---|---|
200 | OK |
Codebeispiele für „Get user stats“
Anforderungsbeispiel
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>" \
-H "X-GitHub-Api-Version: 2022-11-28" \
"https://api.github.com/orgs/ORG/insights/api/user-stats/USER_ID?min_timestamp=MIN_TIMESTAMP"
Response
Status: 200
[
{
"actor_type": "oauth_app",
"actor_id": 954453,
"actor_name": "GitHub Actions",
"oauth_application_id": 1245,
"total_request_count": 544665,
"rate_limited_request_count": 13,
"last_request_timestamp": "2024-09-18T15:43:03Z",
"last_rate_limited_timestamp": "2024-09-18T06:30:09Z"
}
]