Table Of Contents

Feedback

User Guide

First time using the AWS CLI? See the User Guide for help getting started.

[ aws . apigateway ]

import-rest-api

Description

A feature of the API Gateway control service for creating a new API from an external API definition file.

See also: AWS API Documentation

Synopsis

  import-rest-api
[--fail-on-warnings | --no-fail-on-warnings]
[--parameters <value>]
--body <value>
[--cli-input-json <value>]
[--generate-cli-skeleton <value>]

Options

--fail-on-warnings | --no-fail-on-warnings (boolean)

A query parameter to indicate whether to rollback the API creation (true ) or not (false ) when a warning is encountered. The default value is false .

--parameters (map)

A key-value map of context-specific query string parameters specifying the behavior of different API importing operations. The following shows operation-specific parameters and their supported values.

To exclude DocumentationParts from the import, set parameters as ignore=documentation .

To configure the endpoint type, set parameters as endpointConfigurationTypes=EDGE or``endpointConfigurationTypes=REGIONAL`` . The default endpoint type is EDGE .

To handle imported basePath , set parameters as basePath=ignore , basePath=prepend or basePath=split .

For example, the AWS CLI command to exclude documentation from the imported API is:

aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json

The AWS CLI command to set the regional endpoint on the imported API is:

aws apigateway import-rest-api --parameters endpointConfigurationTypes=REGIONAL --body 'file:///path/to/imported-api-body.json

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

--body (blob)

The POST request body containing external API definitions. Currently, only Swagger definition JSON files are supported. The maximum size of the API definition file is 2MB.

--cli-input-json (string) Performs service operation based on the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, the CLI values will override the JSON-provided values.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

Examples

To import a Swagger template and create an API

Command:

aws apigateway import-rest-api --body 'file:///path/to/API_Swagger_template.json'

Output

id -> (string)

The API's identifier. This identifier is unique across all of your APIs in API Gateway.

name -> (string)

The API's name.

description -> (string)

The API's description.

createdDate -> (timestamp)

The timestamp when the API was created.

version -> (string)

A version identifier for the API.

warnings -> (list)

The warning messages reported when failonwarnings is turned on during API import.

(string)

binaryMediaTypes -> (list)

The list of binary media types supported by the RestApi . By default, the RestApi supports only UTF-8-encoded text payloads.

(string)

endpointConfiguration -> (structure)

The endpoint configuration of this RestApi showing the endpoint types of the API.

types -> (list)

A list of endpoint types of an API ( RestApi ) or its custom domain name ( DomainName ). For an edge-optimized API and its custom domain name, the endpoint type is "EDGE" . For a regional API and its custom domain name, the endpoint type is REGIONAL .

(string)

The endpoint type. The valid value is EDGE for edge-optimized API setup, most suitable for mobile applications, REGIONAL for regional API endpoint setup, most suitable for calling from AWS Region