UpdateUsageCommand

Grants a temporary extension to the remaining quota of a usage plan associated with a specified API key.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { APIGatewayClient, UpdateUsageCommand } from "@aws-sdk/client-api-gateway"; // ES Modules import
// const { APIGatewayClient, UpdateUsageCommand } = require("@aws-sdk/client-api-gateway"); // CommonJS import
const client = new APIGatewayClient(config);
const input = { // UpdateUsageRequest
  usagePlanId: "STRING_VALUE", // required
  keyId: "STRING_VALUE", // required
  patchOperations: [ // ListOfPatchOperation
    { // PatchOperation
      op: "add" || "remove" || "replace" || "move" || "copy" || "test",
      path: "STRING_VALUE",
      value: "STRING_VALUE",
      from: "STRING_VALUE",
    },
  ],
};
const command = new UpdateUsageCommand(input);
const response = await client.send(command);
// { // Usage
//   usagePlanId: "STRING_VALUE",
//   startDate: "STRING_VALUE",
//   endDate: "STRING_VALUE",
//   items: { // MapOfKeyUsages
//     "<keys>": [ // ListOfUsage
//       [ // ListOfLong
//         Number("long"),
//       ],
//     ],
//   },
//   position: "STRING_VALUE",
// };

UpdateUsageCommand Input

See UpdateUsageCommandInput for more details

Parameter
Type
Description
keyId
Required
string | undefined

The identifier of the API key associated with the usage plan in which a temporary extension is granted to the remaining quota.

usagePlanId
Required
string | undefined

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

patchOperations
PatchOperation[] | undefined

For more information about supported patch operations, see Patch Operations .

UpdateUsageCommand Output

See UpdateUsageCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
endDate
string | undefined

The ending date of the usage data.

items
Record<string, number[][]> | undefined

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].

position
string | undefined

The current pagination position in the paged result set.

startDate
string | undefined

The starting date of the usage data.

usagePlanId
string | undefined

The plan Id associated with this usage data.

Throws

Name
Fault
Details
BadRequestException
client

The submitted request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

ConflictException
client

The request configuration has conflicts. For details, see the accompanying error message.

LimitExceededException
client

The request exceeded the rate limit. Retry after the specified time period.

NotFoundException
client

The requested resource is not found. Make sure that the request URI is correct.

TooManyRequestsException
client

The request has reached its throttling limit. Retry after the specified time period.

UnauthorizedException
client

The request is denied because the caller has insufficient permissions.

APIGatewayServiceException
Base exception class for all service exceptions from APIGateway service.