Skip to main content

methods

Creates, updates, deletes, gets or lists a methods resource.

Overview

Namemethods
TypeResource
Idaws.apigateway.methods

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
api_key_requiredbooleanA boolean flag specifying whether a valid ApiKey is required to invoke this method.
authorization_scopesarrayA 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.
authorization_typestringThe 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.
authorizer_idstringThe identifier of an Authorizer to use on this method. The authorizationType must be CUSTOM.
http_methodstringThe method's HTTP verb.
method_integrationobjectRepresents an HTTP, HTTP_PROXY, AWS, AWS_PROXY, or Mock integration.
method_responsesobjectGets a method response associated with a given HTTP status code.
operation_namestringA 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.
request_modelsobjectA 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).
request_parametersobjectA 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.
request_validator_idstringThe identifier of a RequestValidator for request validation.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_methodselectrestapi_id, resource_id, http_method, regionDescribe an existing Method resource.
update_methodupdaterestapi_id, resource_id, http_method, regionUpdates an existing Method resource.
put_methodreplacerestapi_id, resource_id, http_method, region, authorizationTypeAdd a method to an existing Resource resource.
delete_methoddeleterestapi_id, resource_id, http_method, regionDeletes an existing Method resource.

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
http_methodstringThe HTTP verb of the Method resource.
regionstringAWS region (default: us-east-1)
resource_idstringThe Resource identifier for the Method resource.
restapi_idstringThe string identifier of the associated RestApi.

SELECT examples

Describe an existing Method resource.

SELECT
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
http_method,
method_integration,
method_responses,
operation_name,
request_models,
request_parameters,
request_validator_id
FROM aws.apigateway.methods
WHERE restapi_id = '{{ restapi_id }}' -- required
AND resource_id = '{{ resource_id }}' -- required
AND http_method = '{{ http_method }}' -- required
AND region = '{{ region }}' -- required
;

UPDATE examples

Updates an existing Method resource.

UPDATE aws.apigateway.methods
SET
patchOperations = '{{ patchOperations }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND region = '{{ region }}' --required
RETURNING
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
http_method,
method_integration,
method_responses,
operation_name,
request_models,
request_parameters,
request_validator_id;

REPLACE examples

Add a method to an existing Resource resource.

REPLACE aws.apigateway.methods
SET
authorizationType = '{{ authorizationType }}',
authorizerId = '{{ authorizerId }}',
apiKeyRequired = {{ apiKeyRequired }},
operationName = '{{ operationName }}',
requestParameters = '{{ requestParameters }}',
requestModels = '{{ requestModels }}',
requestValidatorId = '{{ requestValidatorId }}',
authorizationScopes = '{{ authorizationScopes }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND region = '{{ region }}' --required
AND authorizationType = '{{ authorizationType }}' --required
RETURNING
api_key_required,
authorization_scopes,
authorization_type,
authorizer_id,
http_method,
method_integration,
method_responses,
operation_name,
request_models,
request_parameters,
request_validator_id;

DELETE examples

Deletes an existing Method resource.

DELETE FROM aws.apigateway.methods
WHERE restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND region = '{{ region }}' --required
;