UpdateMethodCommand

Updates an existing Method resource.

Example Syntax

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

import { APIGatewayClient, UpdateMethodCommand } from "@aws-sdk/client-api-gateway"; // ES Modules import
// const { APIGatewayClient, UpdateMethodCommand } = require("@aws-sdk/client-api-gateway"); // CommonJS import
const client = new APIGatewayClient(config);
const input = { // UpdateMethodRequest
  restApiId: "STRING_VALUE", // required
  resourceId: "STRING_VALUE", // required
  httpMethod: "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 UpdateMethodCommand(input);
const response = await client.send(command);
// { // Method
//   httpMethod: "STRING_VALUE",
//   authorizationType: "STRING_VALUE",
//   authorizerId: "STRING_VALUE",
//   apiKeyRequired: true || false,
//   requestValidatorId: "STRING_VALUE",
//   operationName: "STRING_VALUE",
//   requestParameters: { // MapOfStringToBoolean
//     "<keys>": true || false,
//   },
//   requestModels: { // MapOfStringToString
//     "<keys>": "STRING_VALUE",
//   },
//   methodResponses: { // MapOfMethodResponse
//     "<keys>": { // MethodResponse
//       statusCode: "STRING_VALUE",
//       responseParameters: {
//         "<keys>": true || false,
//       },
//       responseModels: {
//         "<keys>": "STRING_VALUE",
//       },
//     },
//   },
//   methodIntegration: { // Integration
//     type: "HTTP" || "AWS" || "MOCK" || "HTTP_PROXY" || "AWS_PROXY",
//     httpMethod: "STRING_VALUE",
//     uri: "STRING_VALUE",
//     connectionType: "INTERNET" || "VPC_LINK",
//     connectionId: "STRING_VALUE",
//     credentials: "STRING_VALUE",
//     requestParameters: "<MapOfStringToString>",
//     requestTemplates: "<MapOfStringToString>",
//     passthroughBehavior: "STRING_VALUE",
//     contentHandling: "CONVERT_TO_BINARY" || "CONVERT_TO_TEXT",
//     timeoutInMillis: Number("int"),
//     cacheNamespace: "STRING_VALUE",
//     cacheKeyParameters: [ // ListOfString
//       "STRING_VALUE",
//     ],
//     integrationResponses: { // MapOfIntegrationResponse
//       "<keys>": { // IntegrationResponse
//         statusCode: "STRING_VALUE",
//         selectionPattern: "STRING_VALUE",
//         responseParameters: "<MapOfStringToString>",
//         responseTemplates: "<MapOfStringToString>",
//         contentHandling: "CONVERT_TO_BINARY" || "CONVERT_TO_TEXT",
//       },
//     },
//     tlsConfig: { // TlsConfig
//       insecureSkipVerification: true || false,
//     },
//   },
//   authorizationScopes: [
//     "STRING_VALUE",
//   ],
// };

UpdateMethodCommand Input

See UpdateMethodCommandInput for more details

Parameter
Type
Description
httpMethod
Required
string | undefined

The HTTP verb of the Method resource.

resourceId
Required
string | undefined

The Resource identifier for the Method resource.

restApiId
Required
string | undefined

The string identifier of the associated RestApi.

patchOperations
PatchOperation[] | undefined

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

UpdateMethodCommand Output

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.
apiKeyRequired
boolean | undefined

A boolean flag specifying whether a valid ApiKey is required to invoke this method.

authorizationScopes
string[] | undefined

A list of authorization scopes configured on the method. The scopes are used with a COGNITO_USER_POOLS authorizer to authorize the method invocation. The authorization works by matching the method scopes against the scopes parsed from the access token in the incoming request. The method invocation is authorized if any method scopes matches a claimed scope in the access token. Otherwise, the invocation is not authorized. When the method scope is configured, the client must provide an access token instead of an identity token for authorization purposes.

authorizationType
string | undefined

The method's authorization type. Valid values are NONE for open access, AWS_IAM for using AWS IAM permissions, CUSTOM for using a custom authorizer, or COGNITO_USER_POOLS for using a Cognito user pool.

authorizerId
string | undefined

The identifier of an Authorizer to use on this method. The authorizationType must be CUSTOM.

httpMethod
string | undefined

The method's HTTP verb.

methodIntegration
Integration | undefined

Gets the method's integration responsible for passing the client-submitted request to the back end and performing necessary transformations to make the request compliant with the back end.

methodResponses
Record<string, MethodResponse> | undefined

Gets a method response associated with a given HTTP status code.

operationName
string | undefined

A human-friendly operation identifier for the method. For example, you can assign the operationName of ListPets for the GET /pets method in the PetStore example.

requestModels
Record<string, string> | undefined

A key-value map specifying data schemas, represented by Model resources, (as the mapped value) of the request payloads of given content types (as the mapping key).

requestParameters
Record<string, boolean> | undefined

A key-value map defining required or optional method request parameters that can be accepted by API Gateway. A key is a method request parameter name matching the pattern of method.request.{location}.{name}, where location is querystring, path, or header and name is a valid and unique parameter name. The value associated with the key is a Boolean flag indicating whether the parameter is required (true) or optional (false). The method request parameter names defined here are available in Integration to be mapped to integration request parameters or templates.

requestValidatorId
string | undefined

The identifier of a RequestValidator for request validation.

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.

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.