Skip to main content

models

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

Overview

Namemodels
TypeResource
Idaws.apigateway.models

Fields

The following fields are returned by SELECT queries:

NameDatatypeDescription
idstringThe identifier for the model resource.
namestringThe name of the model. Must be an alphanumeric string.
content_typestringThe content-type for the model.
descriptionstringThe description of the model.
schemastringThe schema for the model. For application/json models, this should be JSON schema draft 4 model. Do not include "*/" characters in the description of any properties because such "*/" characters may be interpreted as the closing marker for comments in some languages, such as Java or JavaScript, causing the installation of your API's SDK generated by API Gateway to fail.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_modelselectrestapi_id, model_name, regionflattenDescribes an existing model defined for a RestApi resource.
get_modelsselectrestapi_id, regionposition, limitDescribes existing Models defined for a RestApi resource.
create_modelinsertrestapi_id, region, name, contentTypeAdds a new Model resource to an existing RestApi resource.
update_modelupdaterestapi_id, model_name, regionChanges information about a model. The maximum size of the model is 400 KB.
delete_modeldeleterestapi_id, model_name, regionDeletes a model.

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
model_namestringThe name of the model to delete.
regionstringAWS region (default: us-east-1)
restapi_idstringThe string identifier of the associated RestApi.
flattenbooleanA query parameter of a Boolean value to resolve (true) all external model references and returns a flattened model schema or not (false) The default is false.
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

Describes an existing model defined for a RestApi resource.

SELECT
id,
name,
content_type,
description,
schema
FROM aws.apigateway.models
WHERE restapi_id = '{{ restapi_id }}' -- required
AND model_name = '{{ model_name }}' -- required
AND region = '{{ region }}' -- required
AND flatten = '{{ flatten }}'
;

INSERT examples

Adds a new Model resource to an existing RestApi resource.

INSERT INTO aws.apigateway.models (
name,
description,
schema,
contentType,
restapi_id,
region
)
SELECT
'{{ name }}' /* required */,
'{{ description }}',
'{{ schema }}',
'{{ contentType }}' /* required */,
'{{ restapi_id }}',
'{{ region }}'
RETURNING
id,
name,
content_type,
description,
schema
;

UPDATE examples

Changes information about a model. The maximum size of the model is 400 KB.

UPDATE aws.apigateway.models
SET
patchOperations = '{{ patchOperations }}'
WHERE
restapi_id = '{{ restapi_id }}' --required
AND model_name = '{{ model_name }}' --required
AND region = '{{ region }}' --required
RETURNING
id,
name,
content_type,
description,
schema;

DELETE examples

Deletes a model.

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