get_usage

APIGateway.Client.get_usage(**kwargs)

Gets the usage data of a usage plan in a specified time interval.

See also: AWS API Documentation

Request Syntax

response = client.get_usage(
    usagePlanId='string',
    keyId='string',
    startDate='string',
    endDate='string',
    position='string',
    limit=123
)
Parameters
  • usagePlanId (string) --

    [REQUIRED]

    The Id of the usage plan associated with the usage data.

  • keyId (string) -- The Id of the API key associated with the resultant usage data.
  • startDate (string) --

    [REQUIRED]

    The starting date (e.g., 2016-01-01) of the usage data.

  • endDate (string) --

    [REQUIRED]

    The ending date (e.g., 2016-12-31) of the usage data.

  • position (string) -- The current pagination position in the paged result set.
  • limit (integer) -- The maximum number of returned results per page. The default value is 25 and the maximum value is 500.
Return type

dict

Returns

Response Syntax

{
    'usagePlanId': 'string',
    'startDate': 'string',
    'endDate': 'string',
    'position': 'string',
    'items': {
        'string': [
            [
                123,
            ],
        ]
    }
}

Response Structure

  • (dict) --

    Represents the usage data of a usage plan.

    • usagePlanId (string) --

      The plan Id associated with this usage data.

    • startDate (string) --

      The starting date of the usage data.

    • endDate (string) --

      The ending date of the usage data.

    • position (string) --

    • items (dict) --

      The usage data, as daily logs of used and remaining quotas, over the specified time interval indexed over the API keys in a usage plan. For example, {..., "values" : { "{api_key}" : [ [0, 100], [10, 90], [100, 10]]} , where {api_key} stands for an API key value and the daily log entry is of the format [used quota, remaining quota] .

      • (string) --
        • (list) --
          • (list) --
            • (integer) --

Exceptions

  • APIGateway.Client.exceptions.BadRequestException
  • APIGateway.Client.exceptions.UnauthorizedException
  • APIGateway.Client.exceptions.NotFoundException
  • APIGateway.Client.exceptions.TooManyRequestsException