[ aws . apigatewayv2 ]

export-api

Description

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  export-api
--api-id <value>
[--export-version <value>]
[--include-extensions | --no-include-extensions]
--output-type <value>
--specification <value>
[--stage-name <value>]
<outfile>

Options

--api-id (string)

The API identifier.

--export-version (string)

The version of the API Gateway export algorithm. API Gateway uses the latest version by default. Currently, the only supported version is 1.0.

--include-extensions | --no-include-extensions (boolean)

Specifies whether to include API Gateway extensions in the exported API definition. API Gateway extensions are included by default.

--output-type (string)

The output type of the exported definition file. Valid values are JSON and YAML.

Possible values:

  • YAML

  • JSON

--specification (string)

The version of the API specification to use. OAS30, for OpenAPI 3.0, is the only supported value.

Possible values:

  • OAS30

--stage-name (string)

The name of the API stage to export. If you don’t specify this property, a representation of the latest API configuration is exported.

outfile (string) Filename where the content will be saved

See ‘aws help’ for descriptions of global parameters.

Examples

Note

To use the following examples, you must have the AWS CLI installed and configured. See the Getting started guide in the AWS CLI User Guide for more information.

Unless otherwise stated, all examples have unix-like quotation rules. These examples will need to be adapted to your terminal’s quoting rules. See Using quotation marks with strings in the AWS CLI User Guide .

To export an OpenAPI definition of an HTTP API

The following export-api example exports an OpenAPI 3.0 definition of an API stage named prod to a YAML file named stage-definition.yaml. The exported definition file includes API Gateway extensions by default.

aws apigatewayv2 export-api \
    --api-id a1b2c3d4 \
    --output-type YAML \
    --specification OAS30 \
    --stage-name prod \
    stage-definition.yaml

This command produces no output.

For more information, see Exporting an HTTP API from API Gateway in the Amazon API Gateway Developer Guide.

Output

body -> (blob)

Represents an exported definition of an API in a particular output format, for example, YAML. The API is serialized to the requested specification, for example, OpenAPI 3.0.