Skip to main content

api_insights_subject_stats

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

Overview

Nameapi_insights_subject_stats
TypeResource
Idgithub.orgs.api_insights_subject_stats

Fields

The following fields are returned by SELECT queries:

Response

NameDatatypeDescription
subject_idinteger (int64)
subject_namestring
last_rate_limited_timestampstring
last_request_timestampstring
rate_limited_request_countinteger
subject_typestring
total_request_countinteger

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_subject_statsselectorg, min_timestampmax_timestamp, page, per_page, direction, sort, subject_name_substringGet API request statistics for all subjects within an organization within a specified time frame. Subjects can be users or GitHub Apps.

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.
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.
subject_name_substringstringProviding a substring will filter results where the subject name contains the substring. This is a case-insensitive search.

SELECT examples

Get API request statistics for all subjects within an organization within a specified time frame. Subjects can be users or GitHub Apps.

SELECT
subject_id,
subject_name,
last_rate_limited_timestamp,
last_request_timestamp,
rate_limited_request_count,
subject_type,
total_request_count
FROM github.orgs.api_insights_subject_stats
WHERE org = '{{ org }}' -- 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 subject_name_substring = '{{ subject_name_substring }}'
;