Skip to main content

method_responses

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

Overview

Namemethod_responses
TypeResource
Idaws.apigateway.method_responses

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
response_modelsobjectSpecifies the Model resources used for the response's content-type. Response models are represented as a key/value map, with a content-type as the key and a Model name as the value.
response_parametersobjectA key-value map specifying required or optional response parameters that API Gateway can send back to the caller. A key defines a method response header and the value specifies whether the associated method response header is required or not. The expression of the key must match the pattern method.response.header.{name}, where name is a valid and unique header name. API Gateway passes certain integration response data to the method response headers specified here according to the mapping you prescribe in the API's IntegrationResponse. The integration response data that can be mapped include an integration response header expressed in integration.response.header.{name}, a static value enclosed within a pair of single quotes (e.g., 'application/json'), or a JSON expression from the back-end response payload in the form of integration.response.body.{JSON-expression}, where JSON-expression is a valid JSON expression without the $ prefix.)
status_codestringThe status code. (pattern: <code>[1-5]\d\d</code>)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_method_responseselectrestapi_id, resource_id, http_method, status_code, regionDescribes a MethodResponse resource.
update_method_responseupdaterestapi_id, resource_id, http_method, status_code, regionUpdates an existing MethodResponse resource.
put_method_responsereplacerestapi_id, resource_id, http_method, status_code, regionAdds a MethodResponse to an existing Method resource.
delete_method_responsedeleterestapi_id, resource_id, http_method, status_code, regionDeletes an existing MethodResponse 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 MethodResponse resource.
restapi_idstringThe string identifier of the associated RestApi.
status_codestringThe status code identifier for the MethodResponse resource.

SELECT examples

Describes a MethodResponse resource.

SELECT
response_models,
response_parameters,
status_code
FROM aws.apigateway.method_responses
WHERE restapi_id = '{{ restapi_id }}' -- required
AND resource_id = '{{ resource_id }}' -- required
AND http_method = '{{ http_method }}' -- required
AND status_code = '{{ status_code }}' -- required
AND region = '{{ region }}' -- required
;

UPDATE examples

Updates an existing MethodResponse resource.

UPDATE aws.apigateway.method_responses
SET
patchOperations = '{{ patchOperations }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND status_code = '{{ status_code }}' --required
AND region = '{{ region }}' --required
RETURNING
response_models,
response_parameters,
status_code;

REPLACE examples

Adds a MethodResponse to an existing Method resource.

REPLACE aws.apigateway.method_responses
SET
responseParameters = '{{ responseParameters }}',
responseModels = '{{ responseModels }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND http_method = '{{ http_method }}' --required
AND status_code = '{{ status_code }}' --required
AND region = '{{ region }}' --required
RETURNING
response_models,
response_parameters,
status_code;

DELETE examples

Deletes an existing MethodResponse resource.

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