method_responses
Creates, updates, deletes, gets or lists a method_responses resource.
Overview
| Name | method_responses |
| Type | Resource |
| Id | aws.apigateway.method_responses |
Fields
The following fields are returned by SELECT queries:
- get_method_response
| Name | Datatype | Description |
|---|---|---|
response_models | object | Specifies 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_parameters | object | A 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_code | string | The status code. (pattern: <code>[1-5]\d\d</code>) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get_method_response | select | restapi_id, resource_id, http_method, status_code, region | Describes a MethodResponse resource. | |
update_method_response | update | restapi_id, resource_id, http_method, status_code, region | Updates an existing MethodResponse resource. | |
put_method_response | replace | restapi_id, resource_id, http_method, status_code, region | Adds a MethodResponse to an existing Method resource. | |
delete_method_response | delete | restapi_id, resource_id, http_method, status_code, region | Deletes 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.
| Name | Datatype | Description |
|---|---|---|
http_method | string | The HTTP verb of the Method resource. |
region | string | AWS region (default: us-east-1) |
resource_id | string | The Resource identifier for the MethodResponse resource. |
restapi_id | string | The string identifier of the associated RestApi. |
status_code | string | The status code identifier for the MethodResponse resource. |
SELECT examples
- get_method_response
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
- update_method_response
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
- put_method_response
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
- delete_method_response
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
;