Amazon API Gateway

2016/04/05 - Amazon API Gateway - 2 new 10 updated api methods

PutRestApi (new) Link ¶

A feature of the Amazon 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.

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]

The identifier of the RestApi to be updated.

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 headers supplied as part of the request.

  • (string) --

    • (string) --

type body

bytes or seekable file-like object

param body

[REQUIRED]

The PUT request body containing external API definitions. Currently, only Swagger definition JSON files are supported.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --

ImportRestApi (new) Link ¶

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

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

Custom header parameters as part of the request.

  • (string) --

    • (string) --

type body

bytes or seekable file-like object

param body

[REQUIRED]

The POST request body containing external API definitions. Currently, only Swagger definition JSON files are supported.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --

CreateAuthorizer (updated) Link ¶
Changes (both)
{'authType': 'string'}

Adds a new Authorizer resource to an existing RestApi resource.

Request Syntax

client.create_authorizer(
    restApiId='string',
    name='string',
    type='TOKEN',
    authType='string',
    authorizerUri='string',
    authorizerCredentials='string',
    identitySource='string',
    identityValidationExpression='string',
    authorizerResultTtlInSeconds=123
)
type restApiId

string

param restApiId

[REQUIRED]

The RestApi identifier under which the Authorizer will be created.

type name

string

param name

[REQUIRED]

[Required] The name of the authorizer.

type type

string

param type

[REQUIRED]

[Required] The type of the authorizer.

type authType

string

param authType

Optional customer-defined field, used in Swagger imports/exports. Has no functional impact.

type authorizerUri

string

param authorizerUri

[REQUIRED]

[Required] Specifies the authorizer's Uniform Resource Identifier (URI).

type authorizerCredentials

string

param authorizerCredentials

Specifies the credentials required for the authorizer, if any.

type identitySource

string

param identitySource

[REQUIRED]

[Required] The source of the identity in an incoming request.

type identityValidationExpression

string

param identityValidationExpression

A validation expression for the incoming identity.

type authorizerResultTtlInSeconds

integer

param authorizerResultTtlInSeconds

The TTL of cached authorizer results.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'type': 'TOKEN',
    'authType': 'string',
    'authorizerUri': 'string',
    'authorizerCredentials': 'string',
    'identitySource': 'string',
    'identityValidationExpression': 'string',
    'authorizerResultTtlInSeconds': 123
}

Response Structure

  • (dict) --

    Represents an authorization layer for methods. If enabled on a method, API Gateway will activate the authorizer when a client calls the method.

    • id (string) --

      The identifier for the authorizer resource.

    • name (string) --

      [Required] The name of the authorizer.

    • type (string) --

      [Required] The type of the authorizer. Currently, the only valid type is TOKEN.

    • authType (string) --

      Optional customer-defined field, used in Swagger imports/exports. Has no functional impact.

    • authorizerUri (string) --

      [Required] Specifies the authorizer's Uniform Resource Identifier (URI). For TOKEN authorizers, this must be a well-formed Lambda function URI. The URI should be of the form arn:aws:apigateway:{region}:lambda:path/{service_api} . Region is used to determine the right endpoint. In this case, path is used to indicate that the remaining substring in the URI should be treated as the path to the resource, including the initial / . For Lambda functions, this is usually of the form /2015-03-31/functions/[FunctionARN]/invocations

    • authorizerCredentials (string) --

      Specifies the credentials required for the authorizer, if any. Two options are available. To specify an IAM Role for Amazon API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null.

    • identitySource (string) --

      [Required] The source of the identity in an incoming request. For TOKEN authorizers, this value is a mapping expression with the same syntax as integration parameter mappings. The only valid source for tokens is 'header', so the expression should match 'method.request.header.[headerName]'. The value of the header '[headerName]' will be interpreted as the incoming token.

    • identityValidationExpression (string) --

      A validation expression for the incoming identity. For TOKEN authorizers, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.

    • authorizerResultTtlInSeconds (integer) --

      The TTL in seconds of cached authorizer results. If greater than 0, API Gateway will cache authorizer responses. If this field is not set, the default value is 300. The maximum value is 3600, or 1 hour.

CreateRestApi (updated) Link ¶
Changes (response)
{'warnings': ['string']}

Creates a new RestApi resource.

Request Syntax

client.create_rest_api(
    name='string',
    description='string',
    cloneFrom='string'
)
type name

string

param name

[REQUIRED]

The name of the RestApi .

type description

string

param description

The description of the RestApi .

type cloneFrom

string

param cloneFrom

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

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --

GetAuthorizer (updated) Link ¶
Changes (response)
{'authType': 'string'}

Describe an existing Authorizer resource.

Request Syntax

client.get_authorizer(
    restApiId='string',
    authorizerId='string'
)
type restApiId

string

param restApiId

[REQUIRED]

The RestApi identifier for the Authorizer resource.

type authorizerId

string

param authorizerId

[REQUIRED]

The identifier of the Authorizer resource.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'type': 'TOKEN',
    'authType': 'string',
    'authorizerUri': 'string',
    'authorizerCredentials': 'string',
    'identitySource': 'string',
    'identityValidationExpression': 'string',
    'authorizerResultTtlInSeconds': 123
}

Response Structure

  • (dict) --

    Represents an authorization layer for methods. If enabled on a method, API Gateway will activate the authorizer when a client calls the method.

    • id (string) --

      The identifier for the authorizer resource.

    • name (string) --

      [Required] The name of the authorizer.

    • type (string) --

      [Required] The type of the authorizer. Currently, the only valid type is TOKEN.

    • authType (string) --

      Optional customer-defined field, used in Swagger imports/exports. Has no functional impact.

    • authorizerUri (string) --

      [Required] Specifies the authorizer's Uniform Resource Identifier (URI). For TOKEN authorizers, this must be a well-formed Lambda function URI. The URI should be of the form arn:aws:apigateway:{region}:lambda:path/{service_api} . Region is used to determine the right endpoint. In this case, path is used to indicate that the remaining substring in the URI should be treated as the path to the resource, including the initial / . For Lambda functions, this is usually of the form /2015-03-31/functions/[FunctionARN]/invocations

    • authorizerCredentials (string) --

      Specifies the credentials required for the authorizer, if any. Two options are available. To specify an IAM Role for Amazon API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null.

    • identitySource (string) --

      [Required] The source of the identity in an incoming request. For TOKEN authorizers, this value is a mapping expression with the same syntax as integration parameter mappings. The only valid source for tokens is 'header', so the expression should match 'method.request.header.[headerName]'. The value of the header '[headerName]' will be interpreted as the incoming token.

    • identityValidationExpression (string) --

      A validation expression for the incoming identity. For TOKEN authorizers, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.

    • authorizerResultTtlInSeconds (integer) --

      The TTL in seconds of cached authorizer results. If greater than 0, API Gateway will cache authorizer responses. If this field is not set, the default value is 300. The maximum value is 3600, or 1 hour.

GetAuthorizers (updated) Link ¶
Changes (response)
{'items': {'authType': 'string'}}

Describe an existing Authorizers resource.

Request Syntax

client.get_authorizers(
    restApiId='string',
    position='string',
    limit=123
)
type restApiId

string

param restApiId

[REQUIRED]

The RestApi identifier for the Authorizers resource.

type position

string

param position

If not all Authorizer resources in the response were present, the position will specificy where to start the next page of results.

type limit

integer

param limit

Limit the number of Authorizer resources in the response.

rtype

dict

returns

Response Syntax

{
    'position': 'string',
    'items': [
        {
            'id': 'string',
            'name': 'string',
            'type': 'TOKEN',
            'authType': 'string',
            'authorizerUri': 'string',
            'authorizerCredentials': 'string',
            'identitySource': 'string',
            'identityValidationExpression': 'string',
            'authorizerResultTtlInSeconds': 123
        },
    ]
}

Response Structure

  • (dict) --

    Represents a collection of Authorizer resources.

    • position (string) --

    • items (list) --

      Gets the current list of Authorizer resources in the collection.

      • (dict) --

        Represents an authorization layer for methods. If enabled on a method, API Gateway will activate the authorizer when a client calls the method.

        • id (string) --

          The identifier for the authorizer resource.

        • name (string) --

          [Required] The name of the authorizer.

        • type (string) --

          [Required] The type of the authorizer. Currently, the only valid type is TOKEN.

        • authType (string) --

          Optional customer-defined field, used in Swagger imports/exports. Has no functional impact.

        • authorizerUri (string) --

          [Required] Specifies the authorizer's Uniform Resource Identifier (URI). For TOKEN authorizers, this must be a well-formed Lambda function URI. The URI should be of the form arn:aws:apigateway:{region}:lambda:path/{service_api} . Region is used to determine the right endpoint. In this case, path is used to indicate that the remaining substring in the URI should be treated as the path to the resource, including the initial / . For Lambda functions, this is usually of the form /2015-03-31/functions/[FunctionARN]/invocations

        • authorizerCredentials (string) --

          Specifies the credentials required for the authorizer, if any. Two options are available. To specify an IAM Role for Amazon API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null.

        • identitySource (string) --

          [Required] The source of the identity in an incoming request. For TOKEN authorizers, this value is a mapping expression with the same syntax as integration parameter mappings. The only valid source for tokens is 'header', so the expression should match 'method.request.header.[headerName]'. The value of the header '[headerName]' will be interpreted as the incoming token.

        • identityValidationExpression (string) --

          A validation expression for the incoming identity. For TOKEN authorizers, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.

        • authorizerResultTtlInSeconds (integer) --

          The TTL in seconds of cached authorizer results. If greater than 0, API Gateway will cache authorizer responses. If this field is not set, the default value is 300. The maximum value is 3600, or 1 hour.

GetRestApi (updated) Link ¶
Changes (response)
{'warnings': ['string']}

Lists the RestApi resource in the collection.

Request Syntax

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

string

param restApiId

[REQUIRED]

The identifier of the RestApi resource.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --

GetRestApis (updated) Link ¶
Changes (response)
{'items': {'warnings': ['string']}}

Lists the RestApis resources for your collection.

Request Syntax

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

string

param position

The position of the current RestApis resource in the collection to get information about.

type limit

integer

param limit

The maximum number of RestApi resources in the collection to get information about. The default limit is 25. It should be an integer between 1 - 500.

rtype

dict

returns

Response Syntax

{
    'position': 'string',
    'items': [
        {
            'id': 'string',
            'name': 'string',
            'description': 'string',
            'createdDate': datetime(2015, 1, 1),
            'warnings': [
                'string',
            ]
        },
    ]
}

Response Structure

  • (dict) --

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

    • position (string) --

    • items (list) --

      An array of links to the current page of RestApi resources.

      • (dict) --

        Represents a REST API.

        • id (string) --

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

        • name (string) --

          The API's name.

        • description (string) --

          The API's description.

        • createdDate (datetime) --

          The date when the API was created, in ISO 8601 format .

        • warnings (list) --

          • (string) --

ImportRestApi (updated) Link ¶
Changes (response)
{'warnings': ['string']}

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

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

Custom header parameters as part of the request.

  • (string) --

    • (string) --

type body

bytes or seekable file-like object

param body

[REQUIRED]

The POST request body containing external API definitions. Currently, only Swagger definition JSON files are supported.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --

PutRestApi (updated) Link ¶
Changes (response)
{'warnings': ['string']}

A feature of the Amazon 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.

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]

The identifier of the RestApi to be updated.

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 headers supplied as part of the request.

  • (string) --

    • (string) --

type body

bytes or seekable file-like object

param body

[REQUIRED]

The PUT request body containing external API definitions. Currently, only Swagger definition JSON files are supported.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --

UpdateAuthorizer (updated) Link ¶
Changes (response)
{'authType': 'string'}

Updates an existing Authorizer resource.

Request Syntax

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

string

param restApiId

[REQUIRED]

The RestApi identifier for the Authorizer resource.

type authorizerId

string

param authorizerId

[REQUIRED]

The identifier of the Authorizer resource.

type patchOperations

list

param patchOperations

A list of operations describing the updates to apply to the specified resource. The patches are applied in the order specified in the 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) --

      A patch operation whose value indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors.

    • path (string) --

      Operation objects MUST have exactly one "path" member. That member's value is a string containing a JSON-Pointer value that references a location within the target document (the "target location") where the operation is performed.

    • value (string) --

      The actual value content.

    • from (string) --

      The "move" and "copy" operation object MUST contain a "from" member, which is a string containing a JSON Pointer value that references the location in the target document to move the value from.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'type': 'TOKEN',
    'authType': 'string',
    'authorizerUri': 'string',
    'authorizerCredentials': 'string',
    'identitySource': 'string',
    'identityValidationExpression': 'string',
    'authorizerResultTtlInSeconds': 123
}

Response Structure

  • (dict) --

    Represents an authorization layer for methods. If enabled on a method, API Gateway will activate the authorizer when a client calls the method.

    • id (string) --

      The identifier for the authorizer resource.

    • name (string) --

      [Required] The name of the authorizer.

    • type (string) --

      [Required] The type of the authorizer. Currently, the only valid type is TOKEN.

    • authType (string) --

      Optional customer-defined field, used in Swagger imports/exports. Has no functional impact.

    • authorizerUri (string) --

      [Required] Specifies the authorizer's Uniform Resource Identifier (URI). For TOKEN authorizers, this must be a well-formed Lambda function URI. The URI should be of the form arn:aws:apigateway:{region}:lambda:path/{service_api} . Region is used to determine the right endpoint. In this case, path is used to indicate that the remaining substring in the URI should be treated as the path to the resource, including the initial / . For Lambda functions, this is usually of the form /2015-03-31/functions/[FunctionARN]/invocations

    • authorizerCredentials (string) --

      Specifies the credentials required for the authorizer, if any. Two options are available. To specify an IAM Role for Amazon API Gateway to assume, use the role's Amazon Resource Name (ARN). To use resource-based permissions on the Lambda function, specify null.

    • identitySource (string) --

      [Required] The source of the identity in an incoming request. For TOKEN authorizers, this value is a mapping expression with the same syntax as integration parameter mappings. The only valid source for tokens is 'header', so the expression should match 'method.request.header.[headerName]'. The value of the header '[headerName]' will be interpreted as the incoming token.

    • identityValidationExpression (string) --

      A validation expression for the incoming identity. For TOKEN authorizers, this value should be a regular expression. The incoming token from the client is matched against this expression, and will proceed if the token matches. If the token doesn't match, the client receives a 401 Unauthorized response.

    • authorizerResultTtlInSeconds (integer) --

      The TTL in seconds of cached authorizer results. If greater than 0, API Gateway will cache authorizer responses. If this field is not set, the default value is 300. The maximum value is 3600, or 1 hour.

UpdateRestApi (updated) Link ¶
Changes (response)
{'warnings': ['string']}

Changes information about the specified API.

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]

The ID of the RestApi you want to update.

type patchOperations

list

param patchOperations

A list of operations describing the updates to apply to the specified resource. The patches are applied in the order specified in the 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) --

      A patch operation whose value indicates the operation to perform. Its value MUST be one of "add", "remove", "replace", "move", "copy", or "test"; other values are errors.

    • path (string) --

      Operation objects MUST have exactly one "path" member. That member's value is a string containing a JSON-Pointer value that references a location within the target document (the "target location") where the operation is performed.

    • value (string) --

      The actual value content.

    • from (string) --

      The "move" and "copy" operation object MUST contain a "from" member, which is a string containing a JSON Pointer value that references the location in the target document to move the value from.

rtype

dict

returns

Response Syntax

{
    'id': 'string',
    'name': 'string',
    'description': 'string',
    'createdDate': datetime(2015, 1, 1),
    'warnings': [
        'string',
    ]
}

Response Structure

  • (dict) --

    Represents a REST API.

    • id (string) --

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

    • name (string) --

      The API's name.

    • description (string) --

      The API's description.

    • createdDate (datetime) --

      The date when the API was created, in ISO 8601 format .

    • warnings (list) --

      • (string) --