CmdID

CmdID / aws / aws apigateway

aws apigateway put-rest-api

A feature of the API Gateway control service for updating an existing API with an input of external API definitions. AWS CLI reference

2 examples 5 options Its page in the AWS CLI reference

Opens CmdID with your command. It is read in your browser and sent nowhere.

Examples

from aws-cli, each command read by CmdID

Example 1: To overwrite an existing API using a Swagger template

The following put-rest-api example overwrites an existing API using a Swagger template.

aws apigateway put-rest-api --rest-api-id 1234123412 --mode overwrite --body 'fileb:///path/to/API_Swagger_template.json'Identify
--rest-api-idThe string identifier of the associated RestApi.
--modeThe mode query parameter to specify the update mode.
--bodyThe PUT request body containing external API definitions.
Its output
{
    "id": "1234123412",
    "name": "MyAPI",
    "description": "API defined by a Swagger template",
    "createdDate": "2016-02-23T23:39:00+00:00",
    "version": "1.0",
    "apiKeySource": "HEADER",
    "endpointConfiguration": {
        "types": [
            "EDGE"
        ]
    },
    "disableExecuteApiEndpoint": false,
    "rootResourceId": "a1b2c3d4f5"
}

For more information, see Import an OpenAPI file to update an existing API definition in the Amazon API Gateway Developer Guide.

Example 2: To merge a Swagger template into an existing API

The following put-rest-api example merges a Swagger template into an existing API.

aws apigateway put-rest-api --rest-api-id 1234123412 --mode merge --body 'fileb:///path/to/API_Swagger_template.json'Identify
--rest-api-idThe string identifier of the associated RestApi.
--modeThe mode query parameter to specify the update mode.
--bodyThe PUT request body containing external API definitions.
Its output
{
    "id": "1234123412",
    "name": "MyAPI",
    "description": "API defined by a Swagger template",
    "createdDate": "2016-02-23T23:39:00+00:00",
    "version": "1.0",
    "apiKeySource": "HEADER",
    "endpointConfiguration": {
        "types": [
            "EDGE"
        ]
    },
    "disableExecuteApiEndpoint": false,
    "rootResourceId": "a1b2c3d4f5"
}

For more information, see Import an OpenAPI file to update an existing API definition in the Amazon API Gateway Developer Guide.

Options

5 in the AWS CLI reference
--bodyThe PUT request body containing external API definitions.
--fail-on-warningsA query parameter to indicate whether to rollback the API update (true) or not (false) when a warning is encountered.
--modeThe mode query parameter to specify the update mode.
--parametersCustom header parameters as part of the request.
--rest-api-idThe string identifier of the associated RestApi.