ExportApiCommand

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ApiGatewayV2Client, ExportApiCommand } from "@aws-sdk/client-apigatewayv2"; // ES Modules import
// const { ApiGatewayV2Client, ExportApiCommand } = require("@aws-sdk/client-apigatewayv2"); // CommonJS import
const client = new ApiGatewayV2Client(config);
const input = { // ExportApiRequest
  ApiId: "STRING_VALUE", // required
  ExportVersion: "STRING_VALUE",
  IncludeExtensions: true || false,
  OutputType: "STRING_VALUE", // required
  Specification: "STRING_VALUE", // required
  StageName: "STRING_VALUE",
};
const command = new ExportApiCommand(input);
const response = await client.send(command);
// { // ExportApiResponse
//   body: new Uint8Array(),
// };

ExportApiCommand Input

See ExportApiCommandInput for more details

Parameter
Type
Description
ApiId
Required
string | undefined

The API identifier.

OutputType
Required
string | undefined

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

Specification
Required
string | undefined

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

ExportVersion
string | undefined

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

IncludeExtensions
boolean | undefined

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

StageName
string | undefined

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

ExportApiCommand Output

See ExportApiCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
BadRequestException
client

The request is not valid, for example, the input is incomplete or incorrect. See the accompanying error message for details.

NotFoundException
client

The resource specified in the request was not found. See the message field for more information.

TooManyRequestsException
client

A limit has been exceeded. See the accompanying error message for details.

ApiGatewayV2ServiceException
Base exception class for all service exceptions from ApiGatewayV2 service.