Skip to main content

api_insights_route_stats

Creates, updates, deletes, gets or lists an api_insights_route_stats resource.

Overview​

Nameapi_insights_route_stats
TypeResource
Idgithub.orgs.api_insights_route_stats

Fields​

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
api_routestringThe API path's route template
http_methodstringThe HTTP method
last_rate_limited_timestampstring
last_request_timestampstring
rate_limited_request_countinteger (int64)The total number of requests that were rate limited within the queried time period
total_request_countinteger (int64)The total number of requests within the queried time period

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_route_stats_by_actorselectorg, actor_type, actor_id, min_timestampmax_timestamp, page, per_page, direction, sort, api_route_substringGet API request count statistics for an actor broken down by route within a specified time frame.

Under normal conditions, you can expect API data to appear within 4–6 hours after making a request. During incidents or periods of unusually high volume, it may take longer to show up.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
actor_idintegerThe ID of the actor
actor_typestringThe type of the actor
min_timestampstringThe minimum timestamp to query for stats. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
orgstringThe organization name. The name is not case sensitive.
api_route_substringstringProviding a substring will filter results where the API route contains the substring. This is a case-insensitive search.
directionstringThe direction to sort the results by.
max_timestampstringThe maximum timestamp to query for stats. Defaults to the time 30 days ago. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
pageintegerThe page number of the results to fetch. For more information, see "Using pagination in the REST API."
per_pageintegerThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
sortarrayThe property to sort the results by.

SELECT examples​

Get API request count statistics for an actor broken down by route within a specified time frame.

Under normal conditions, you can expect API data to appear within 4–6 hours after making a request. During incidents or periods of unusually high volume, it may take longer to show up.

SELECT
api_route,
http_method,
last_rate_limited_timestamp,
last_request_timestamp,
rate_limited_request_count,
total_request_count
FROM github.orgs.api_insights_route_stats
WHERE org = '{{ org }}' -- required
AND actor_type = '{{ actor_type }}' -- required
AND actor_id = '{{ actor_id }}' -- required
AND min_timestamp = '{{ min_timestamp }}' -- required
AND max_timestamp = '{{ max_timestamp }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND direction = '{{ direction }}'
AND sort = '{{ sort }}'
AND api_route_substring = '{{ api_route_substring }}'
;