Amazon API Gateway

2018/04/02 - Amazon API Gateway - 6 updated api methods

Changes  Update apigateway client to latest version

CreateRestApi (updated) Link ¶
Changes (both)
{'policy': 'string'}

Creates a new RestApi resource.

See also: AWS API Documentation

Request Syntax

client.create_rest_api(
    name='string',
    description='string',
    version='string',
    cloneFrom='string',
    binaryMediaTypes=[
        'string',
    ],
    minimumCompressionSize=123,
    apiKeySource='HEADER'|'AUTHORIZER',
    endpointConfiguration={
        'types': [
            'REGIONAL'|'EDGE',
        ]
    },
    policy='string'
)
type name:

string

param name:

[REQUIRED]

[Required] The name of the RestApi.

type description:

string

param description:

The description of the RestApi.

type version:

string

param version:

A version identifier for the API.

type cloneFrom:

string

param cloneFrom:

The ID of the RestApi that you want to clone from.

type binaryMediaTypes:

list

param binaryMediaTypes:

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

  • (string) --

type minimumCompressionSize:

integer

param minimumCompressionSize:

A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

type apiKeySource:

string

param apiKeySource:

The source of the API key for metering requests according to a usage plan. Valid values are:

  • HEADER to read the API key from the X-API-Key header of a request.

  • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

type endpointConfiguration:

dict

param endpointConfiguration:

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

type policy:

string

param policy:

A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

rtype:

dict

returns:

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'version': 'string',
    'warnings': [
        'string',
    ],
    'binaryMediaTypes': [
        'string',
    ],
    'minimumCompressionSize': 123,
    'apiKeySource': 'HEADER'|'AUTHORIZER',
    'endpointConfiguration': {
        'types': [
            'REGIONAL'|'EDGE',
        ]
    },
    'policy': 'string'
}

Response Structure

  • (dict) --

    Represents a REST API.

    Create an API

    • 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 (datetime) --

      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) --

    • minimumCompressionSize (integer) --

      A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

    • apiKeySource (string) --

      The source of the API key for metering requests according to a usage plan. Valid values are:

      • HEADER to read the API key from the X-API-Key header of a request.

      • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

    • endpointConfiguration (dict) --

      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

    • policy (string) -- A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

GetRestApi (updated) Link ¶
Changes (response)
{'policy': 'string'}

Lists the RestApi resource in the collection.

See also: AWS API Documentation

Request Syntax

client.get_rest_api(
    restApiId='string'
)
type restApiId:

string

param restApiId:

[REQUIRED]

[Required] The string identifier of the associated RestApi.

rtype:

dict

returns:

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'version': 'string',
    'warnings': [
        'string',
    ],
    'binaryMediaTypes': [
        'string',
    ],
    'minimumCompressionSize': 123,
    'apiKeySource': 'HEADER'|'AUTHORIZER',
    'endpointConfiguration': {
        'types': [
            'REGIONAL'|'EDGE',
        ]
    },
    'policy': 'string'
}

Response Structure

  • (dict) --

    Represents a REST API.

    Create an API

    • 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 (datetime) --

      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) --

    • minimumCompressionSize (integer) --

      A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

    • apiKeySource (string) --

      The source of the API key for metering requests according to a usage plan. Valid values are:

      • HEADER to read the API key from the X-API-Key header of a request.

      • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

    • endpointConfiguration (dict) --

      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

    • policy (string) -- A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

GetRestApis (updated) Link ¶
Changes (response)
{'items': {'policy': 'string'}}

Lists the RestApis resources for your collection.

See also: AWS API Documentation

Request Syntax

client.get_rest_apis(
    position='string',
    limit=123
)
type position:

string

param position:

The current pagination position in the paged result set.

type limit:

integer

param limit:

The maximum number of returned results per page. The default value is 25 and the maximum value is 500.

rtype:

dict

returns:

Response Syntax

{
    'position': 'string',
    'items': [
        {
            'id': 'string',
            'name': 'string',
            'description': 'string',
            'createdDate': datetime(2015, 1, 1),
            'version': 'string',
            'warnings': [
                'string',
            ],
            'binaryMediaTypes': [
                'string',
            ],
            'minimumCompressionSize': 123,
            'apiKeySource': 'HEADER'|'AUTHORIZER',
            'endpointConfiguration': {
                'types': [
                    'REGIONAL'|'EDGE',
                ]
            },
            'policy': 'string'
        },
    ]
}

Response Structure

  • (dict) --

    Contains references to your APIs and links that guide you in how to interact with your collection. A collection offers a paginated view of your APIs.

    Create an API

    • position (string) --

    • items (list) --

      The current page of elements from this collection.

      • (dict) --

        Represents a REST API.

        Create an API

        • 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 (datetime) --

          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) --

        • minimumCompressionSize (integer) --

          A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

        • apiKeySource (string) --

          The source of the API key for metering requests according to a usage plan. Valid values are:

          • HEADER to read the API key from the X-API-Key header of a request.

          • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

        • endpointConfiguration (dict) --

          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

        • policy (string) -- A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

ImportRestApi (updated) Link ¶
Changes (response)
{'policy': 'string'}

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

See also: AWS API Documentation

Request Syntax

client.import_rest_api(
    failOnWarnings=True|False,
    parameters={
        'string': 'string'
    },
    body=b'bytes'|file
)
type failOnWarnings:

boolean

param failOnWarnings:

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.

type parameters:

dict

param parameters:

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

  • (string) --

    • (string) --

type body:

bytes or seekable file-like object

param body:

[REQUIRED]

[Required] 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.

rtype:

dict

returns:

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'version': 'string',
    'warnings': [
        'string',
    ],
    'binaryMediaTypes': [
        'string',
    ],
    'minimumCompressionSize': 123,
    'apiKeySource': 'HEADER'|'AUTHORIZER',
    'endpointConfiguration': {
        'types': [
            'REGIONAL'|'EDGE',
        ]
    },
    'policy': 'string'
}

Response Structure

  • (dict) --

    Represents a REST API.

    Create an API

    • 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 (datetime) --

      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) --

    • minimumCompressionSize (integer) --

      A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

    • apiKeySource (string) --

      The source of the API key for metering requests according to a usage plan. Valid values are:

      • HEADER to read the API key from the X-API-Key header of a request.

      • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

    • endpointConfiguration (dict) --

      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

    • policy (string) -- A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

PutRestApi (updated) Link ¶
Changes (response)
{'policy': 'string'}

A feature of the API Gateway control service for updating an existing API with an input of external API definitions. The update can take the form of merging the supplied definition into the existing API or overwriting the existing API.

See also: AWS API Documentation

Request Syntax

client.put_rest_api(
    restApiId='string',
    mode='merge'|'overwrite',
    failOnWarnings=True|False,
    parameters={
        'string': 'string'
    },
    body=b'bytes'|file
)
type restApiId:

string

param restApiId:

[REQUIRED]

[Required] The string identifier of the associated RestApi.

type mode:

string

param mode:

The mode query parameter to specify the update mode. Valid values are "merge" and "overwrite". By default, the update mode is "merge".

type failOnWarnings:

boolean

param failOnWarnings:

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

type parameters:

dict

param parameters:

Custom header parameters as part of the request. For example, to exclude DocumentationParts from an imported API, set ignore=documentation as a parameters value, as in the AWS CLI command of aws apigateway import-rest-api --parameters ignore=documentation --body 'file:///path/to/imported-api-body.json.

  • (string) --

    • (string) --

type body:

bytes or seekable file-like object

param body:

[REQUIRED]

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

rtype:

dict

returns:

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'version': 'string',
    'warnings': [
        'string',
    ],
    'binaryMediaTypes': [
        'string',
    ],
    'minimumCompressionSize': 123,
    'apiKeySource': 'HEADER'|'AUTHORIZER',
    'endpointConfiguration': {
        'types': [
            'REGIONAL'|'EDGE',
        ]
    },
    'policy': 'string'
}

Response Structure

  • (dict) --

    Represents a REST API.

    Create an API

    • 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 (datetime) --

      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) --

    • minimumCompressionSize (integer) --

      A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

    • apiKeySource (string) --

      The source of the API key for metering requests according to a usage plan. Valid values are:

      • HEADER to read the API key from the X-API-Key header of a request.

      • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

    • endpointConfiguration (dict) --

      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

    • policy (string) -- A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.

UpdateRestApi (updated) Link ¶
Changes (response)
{'policy': 'string'}

Changes information about the specified API.

See also: AWS API Documentation

Request Syntax

client.update_rest_api(
    restApiId='string',
    patchOperations=[
        {
            'op': 'add'|'remove'|'replace'|'move'|'copy'|'test',
            'path': 'string',
            'value': 'string',
            'from': 'string'
        },
    ]
)
type restApiId:

string

param restApiId:

[REQUIRED]

[Required] The string identifier of the associated RestApi.

type patchOperations:

list

param patchOperations:

A list of update operations to be applied to the specified resource and in the order specified in this list.

  • (dict) -- A single patch operation to apply to the specified resource. Please refer to http://tools.ietf.org/html/rfc6902#section-4 for an explanation of how each operation is used.

    • op (string) --

      An update operation to be performed with this PATCH request. The valid value can be add, remove, replace or copy. Not all valid operations are supported for a given resource. Support of the operations depends on specific operational contexts. Attempts to apply an unsupported operation on a resource will return an error message.

    • path (string) --

      The op operation's target, as identified by a JSON Pointer value that references a location within the targeted resource. For example, if the target resource has an updateable property of {"name":"value"}, the path for this property is /name. If the name property value is a JSON object (e.g., {"name": {"child/name": "child-value"}}), the path for the child/name property will be /name/child~1name. Any slash ("/") character appearing in path names must be escaped with "~1", as shown in the example above. Each op operation can have only one path associated with it.

    • value (string) --

      The new target value of the update operation. It is applicable for the add or replace operation. When using AWS CLI to update a property of a JSON value, enclose the JSON object with a pair of single quotes in a Linux shell, e.g., '{"a": ...}'. In a Windows shell, see Using JSON for Parameters.

    • from (string) --

      The copy update operation's source as identified by a JSON-Pointer value referencing the location within the targeted resource to copy the value from. For example, to promote a canary deployment, you copy the canary deployment ID to the affiliated deployment ID by calling a PATCH request on a Stage resource with "op":"copy", "from":"/canarySettings/deploymentId" and "path":"/deploymentId".

rtype:

dict

returns:

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'version': 'string',
    'warnings': [
        'string',
    ],
    'binaryMediaTypes': [
        'string',
    ],
    'minimumCompressionSize': 123,
    'apiKeySource': 'HEADER'|'AUTHORIZER',
    'endpointConfiguration': {
        'types': [
            'REGIONAL'|'EDGE',
        ]
    },
    'policy': 'string'
}

Response Structure

  • (dict) --

    Represents a REST API.

    Create an API

    • 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 (datetime) --

      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) --

    • minimumCompressionSize (integer) --

      A nullable integer that is used to enable compression (with non-negative between 0 and 10485760 (10M) bytes, inclusive) or disable compression (with a null value) on an API. When compression is enabled, compression or decompression is not applied on the payload if the payload size is smaller than this value. Setting it to zero allows compression for any payload size.

    • apiKeySource (string) --

      The source of the API key for metering requests according to a usage plan. Valid values are:

      • HEADER to read the API key from the X-API-Key header of a request.

      • AUTHORIZER to read the API key from the UsageIdentifierKey from a custom authorizer.

    • endpointConfiguration (dict) --

      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

    • policy (string) -- A stringified JSON policy document that applies to this RestApi regardless of the caller and Method configuration.