Skip to main content

apis

Creates, updates, deletes, gets or lists an apis resource.

Overview

Nameapis
TypeResource
Idaws.apigatewayv2.apis

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
api_endpointstringThe URI of the API, of the form {api-id}.execute-api.{region}.amazonaws.com. The stage name is typically appended to this URI to form a complete path to a deployed API stage.
api_gateway_managedbooleanSpecifies whether an API is managed by API Gateway. You can't update or delete a managed API by using API Gateway. A managed API can be deleted only through the tooling or service that created it.
api_idstringThe identifier.
api_key_selection_expressionstringAn expression used to extract information at runtime. See Selection Expressions for more information.
cors_configurationobjectRepresents a CORS configuration. Supported only for HTTP APIs. See Configuring CORS for more information.
created_datestring (date-time)The timestamp when the API was created.
descriptionstringA string with a length between [0-1024].
disable_execute_api_endpointbooleanSpecifies whether clients can invoke your API by using the default execute-api endpoint. By default, clients can invoke your API with the default https:​//{api_id}.execute-api.{region}.amazonaws.com endpoint. To require that clients use a custom domain name to invoke your API, disable the default endpoint.
disable_schema_validationbooleanAvoid validating models when creating a deployment. Supported only for WebSocket APIs.
import_infoarrayThe validation information during API import. This may include particular properties of your OpenAPI definition which are ignored during import. Supported only for HTTP APIs.
ip_address_typestringThe IP address types that can invoke your API or domain name. (ipv4, dualstack)
namestringA string with a length between [1-128].
protocol_typestringRepresents a protocol type. (WEBSOCKET, HTTP)
route_selection_expressionstringAn expression used to extract information at runtime. See Selection Expressions for more information.
tagsobjectA collection of tags associated with the API.
versionstringA string with a length between [1-64].
warningsarrayThe warning messages reported when failonwarnings is turned on during API import.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_apiselectapi_id, regionGets an Api resource.
get_apisselectregionmaxResults, nextTokenGets a collection of Api resources.
create_apiinsertregion, ProtocolTypeCreates an Api resource.
update_apiupdateapi_id, regionUpdates an Api resource.
delete_apideleteapi_id, regionDeletes an Api resource.
reimport_apiexecapi_id, region, Bodybasepath, failOnWarningsPuts an Api resource.
delete_cors_configurationexecapi_id, regionDeletes a CORS configuration.

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
api_idstringThe API identifier.
regionstringAWS region (default: us-east-1)
basepathstringSpecifies how to interpret the base path of the API during import. Valid values are ignore, prepend, and split. The default value is ignore. To learn more, see Set the OpenAPI basePath Property. Supported only for HTTP APIs.
failOnWarningsbooleanSpecifies whether to rollback the API creation when a warning is encountered. By default, API creation continues if a warning is encountered.
maxResultsstringThe maximum number of elements to be returned for this resource.
nextTokenstringThe next page of elements from this collection. Not valid for the last element of the collection.

SELECT examples

Gets an Api resource.

SELECT
api_endpoint,
api_gateway_managed,
api_id,
api_key_selection_expression,
cors_configuration,
created_date,
description,
disable_execute_api_endpoint,
disable_schema_validation,
import_info,
ip_address_type,
name,
protocol_type,
route_selection_expression,
tags,
version,
warnings
FROM aws.apigatewayv2.apis
WHERE api_id = '{{ api_id }}' -- required
AND region = '{{ region }}' -- required
;

INSERT examples

Creates an Api resource.

INSERT INTO aws.apigatewayv2.apis (
ApiKeySelectionExpression,
CorsConfiguration,
CredentialsArn,
Description,
DisableSchemaValidation,
DisableExecuteApiEndpoint,
IpAddressType,
Name,
ProtocolType,
RouteKey,
RouteSelectionExpression,
Tags,
Target,
Version,
region
)
SELECT
'{{ ApiKeySelectionExpression }}',
'{{ CorsConfiguration }}',
'{{ CredentialsArn }}',
'{{ Description }}',
{{ DisableSchemaValidation }},
{{ DisableExecuteApiEndpoint }},
'{{ IpAddressType }}',
'{{ Name }}',
'{{ ProtocolType }}' /* required */,
'{{ RouteKey }}',
'{{ RouteSelectionExpression }}',
'{{ Tags }}',
'{{ Target }}',
'{{ Version }}',
'{{ region }}'
RETURNING
api_endpoint,
api_gateway_managed,
api_id,
api_key_selection_expression,
cors_configuration,
created_date,
description,
disable_execute_api_endpoint,
disable_schema_validation,
import_info,
ip_address_type,
name,
protocol_type,
route_selection_expression,
tags,
version,
warnings
;

UPDATE examples

Updates an Api resource.

UPDATE aws.apigatewayv2.apis
SET
ApiKeySelectionExpression = '{{ ApiKeySelectionExpression }}',
CorsConfiguration = '{{ CorsConfiguration }}',
CredentialsArn = '{{ CredentialsArn }}',
Description = '{{ Description }}',
DisableSchemaValidation = {{ DisableSchemaValidation }},
DisableExecuteApiEndpoint = {{ DisableExecuteApiEndpoint }},
IpAddressType = '{{ IpAddressType }}',
Name = '{{ Name }}',
RouteKey = '{{ RouteKey }}',
RouteSelectionExpression = '{{ RouteSelectionExpression }}',
Target = '{{ Target }}',
Version = '{{ Version }}'
WHERE
api_id = '{{ api_id }}' --required
AND region = '{{ region }}' --required
RETURNING
api_endpoint,
api_gateway_managed,
api_id,
api_key_selection_expression,
cors_configuration,
created_date,
description,
disable_execute_api_endpoint,
disable_schema_validation,
import_info,
ip_address_type,
name,
protocol_type,
route_selection_expression,
tags,
version,
warnings;

DELETE examples

Deletes an Api resource.

DELETE FROM aws.apigatewayv2.apis
WHERE api_id = '{{ api_id }}' --required
AND region = '{{ region }}' --required
;

Lifecycle Methods

Puts an Api resource.

EXEC aws.apigatewayv2.apis.reimport_api
@api_id='{{ api_id }}' --required,
@region='{{ region }}' --required,
@basepath='{{ basepath }}',
@failOnWarnings={{ failOnWarnings }}
@@json=
'{
"Body": "{{ Body }}"
}'
;