Skip to main content

api_insights_user_stats

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

Overview

Nameapi_insights_user_stats
TypeResource
Idgithub.orgs.api_insights_user_stats

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
actor_idinteger (int64)
integration_idinteger (int64)
oauth_application_idinteger (int64)
actor_namestring
actor_typestring
last_rate_limited_timestampstring
last_request_timestampstring
rate_limited_request_countinteger
total_request_countinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_user_statsselectorg, user_id, min_timestampmax_timestamp, page, per_page, direction, sort, actor_name_substringGet API usage statistics within an organization for a user broken down by the type of access.

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
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.
user_idstringThe ID of the user to query for stats
actor_name_substringstringProviding a substring will filter results where the actor name 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 usage statistics within an organization for a user broken down by the type of access.

SELECT
actor_id,
integration_id,
oauth_application_id,
actor_name,
actor_type,
last_rate_limited_timestamp,
last_request_timestamp,
rate_limited_request_count,
total_request_count
FROM github.orgs.api_insights_user_stats
WHERE org = '{{ org }}' -- required
AND user_id = '{{ user_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 actor_name_substring = '{{ actor_name_substring }}'
;