Skip to main content

resources

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

Overview​

Nameresources
TypeResource
Idaws.apigateway.resources

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe resource's identifier.
parent_idstringThe parent resource's identifier.
pathstringThe full path for this resource.
path_partstringThe last path segment for this resource.
resource_methodsobjectGets an API resource's method of a given HTTP verb.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_resourceselectrestapi_id, resource_id, regionembedLists information about a resource.
get_resourcesselectrestapi_id, regionposition, limit, embedLists information about a collection of Resource resources.
create_resourceinsertrestapi_id, parent_id, region, pathPartCreates a Resource resource.
update_resourceupdaterestapi_id, resource_id, regionChanges information about a Resource resource.
delete_resourcedeleterestapi_id, resource_id, regionDeletes a Resource resource.
test_invoke_methodexecrestapi_id, resource_id, http_method, regionSimulate the invocation of a Method in your RestApi with headers, parameters, and an incoming request body.

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_methodstringSpecifies a test invoke method request's HTTP method.
parent_idstringThe parent resource's identifier.
regionstringAWS region (default: us-east-1)
resource_idstringSpecifies a test invoke method request's resource ID.
restapi_idstringThe string identifier of the associated RestApi.
embedarrayA query parameter used to retrieve the specified resources embedded in the returned Resources resource in the response. This embed parameter value is a list of comma-separated strings. Currently, the request supports only retrieval of the embedded Method resources this way. The query parameter value must be a single-valued list and contain the "methods" string. For example, GET /restapis/{restapi_id}/resources?embed=methods.
limitintegerThe maximum number of returned results per page. The default value is 25 and the maximum value is 500.
positionstringThe current pagination position in the paged result set.

SELECT examples​

Lists information about a resource.

SELECT
id,
parent_id,
path,
path_part,
resource_methods
FROM aws.apigateway.resources
WHERE restapi_id = '{{ restapi_id }}' -- required
AND resource_id = '{{ resource_id }}' -- required
AND region = '{{ region }}' -- required
AND embed = '{{ embed }}'
;

INSERT examples​

Creates a Resource resource.

INSERT INTO aws.apigateway.resources (
pathPart,
restapi_id,
parent_id,
region
)
SELECT
'{{ pathPart }}' /* required */,
'{{ restapi_id }}',
'{{ parent_id }}',
'{{ region }}'
RETURNING
id,
parent_id,
path,
path_part,
resource_methods
;

UPDATE examples​

Changes information about a Resource resource.

UPDATE aws.apigateway.resources
SET
patchOperations = '{{ patchOperations }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND resource_id = '{{ resource_id }}' --required
AND region = '{{ region }}' --required
RETURNING
id,
parent_id,
path,
path_part,
resource_methods;

DELETE examples​

Deletes a Resource resource.

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

Lifecycle Methods​

Simulate the invocation of a Method in your RestApi with headers, parameters, and an incoming request body.

EXEC aws.apigateway.resources.test_invoke_method
@restapi_id='{{ restapi_id }}' --required,
@resource_id='{{ resource_id }}' --required,
@http_method='{{ http_method }}' --required,
@region='{{ region }}' --required
@@json=
'{
"pathWithQueryString": "{{ pathWithQueryString }}",
"body": "{{ body }}",
"headers": "{{ headers }}",
"multiValueHeaders": "{{ multiValueHeaders }}",
"clientCertificateId": "{{ clientCertificateId }}",
"stageVariables": "{{ stageVariables }}"
}'
;