- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
UpdateApiKeyCommand
Updates an API key. You can update the key as long as it's not deleted.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { AppSyncClient, UpdateApiKeyCommand } from "@aws-sdk/client-appsync"; // ES Modules import
// const { AppSyncClient, UpdateApiKeyCommand } = require("@aws-sdk/client-appsync"); // CommonJS import
const client = new AppSyncClient(config);
const input = { // UpdateApiKeyRequest
apiId: "STRING_VALUE", // required
id: "STRING_VALUE", // required
description: "STRING_VALUE",
expires: Number("long"),
};
const command = new UpdateApiKeyCommand(input);
const response = await client.send(command);
// { // UpdateApiKeyResponse
// apiKey: { // ApiKey
// id: "STRING_VALUE",
// description: "STRING_VALUE",
// expires: Number("long"),
// deletes: Number("long"),
// },
// };
UpdateApiKeyCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
apiId Required | string | undefined | The ID for the GraphQL API. |
id Required | string | undefined | The API key ID. |
description | string | undefined | A description of the purpose of the API key. |
expires | number | undefined | From the update time, the time after which the API key expires. The date is represented as seconds since the epoch. For more information, see . |
UpdateApiKeyCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
apiKey | ApiKey | undefined | The API key. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
ApiKeyValidityOutOfBoundsException | client | The API key expiration must be set to a value between 1 and 365 days from creation (for |
BadRequestException | client | The request is not well formed. For example, a value is invalid or a required field is missing. Check the field values, and then try again. |
InternalFailureException | server | An internal AppSync error occurred. Try your request again. |
LimitExceededException | client | The request exceeded a limit. Try your request again. |
NotFoundException | client | The resource specified in the request was not found. Check the resource, and then try again. |
UnauthorizedException | client | You aren't authorized to perform this operation. |
AppSyncServiceException | Base exception class for all service exceptions from AppSync service. |