Amazon API Gateway

2018/10/04 - Amazon API Gateway - 2 updated api methods

Changes  Adding support for multi-value parameters in TestInvokeMethod and TestInvokeAuthorizer.

TestInvokeAuthorizer (updated) Link ¶
Changes (request)
{'multiValueHeaders': {'string': ['string']}}

Simulate the execution of an Authorizer in your RestApi with headers, parameters, and an incoming request body.

Enable custom authorizers

See also: AWS API Documentation

Request Syntax

client.test_invoke_authorizer(
    restApiId='string',
    authorizerId='string',
    headers={
        'string': 'string'
    },
    multiValueHeaders={
        'string': [
            'string',
        ]
    },
    pathWithQueryString='string',
    body='string',
    stageVariables={
        'string': 'string'
    },
    additionalContext={
        'string': 'string'
    }
)
type restApiId

string

param restApiId

[REQUIRED]

[Required] The string identifier of the associated RestApi.

type authorizerId

string

param authorizerId

[REQUIRED]

[Required] Specifies a test invoke authorizer request's Authorizer ID.

type headers

dict

param headers

[Required] A key-value map of headers to simulate an incoming invocation request. This is where the incoming authorization token, or identity source, should be specified.

  • (string) --

    • (string) --

type multiValueHeaders

dict

param multiValueHeaders

[Optional] The headers as a map from string to list of values to simulate an incoming invocation request. This is where the incoming authorization token, or identity source, may be specified.

  • (string) --

    • (list) --

      • (string) --

type pathWithQueryString

string

param pathWithQueryString

[Optional] The URI path, including query string, of the simulated invocation request. Use this to specify path parameters and query string parameters.

type body

string

param body

[Optional] The simulated request body of an incoming invocation request.

type stageVariables

dict

param stageVariables

A key-value map of stage variables to simulate an invocation on a deployed Stage.

  • (string) --

    • (string) --

type additionalContext

dict

param additionalContext

[Optional] A key-value map of additional context variables.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'clientStatus': 123,
    'log': 'string',
    'latency': 123,
    'principalId': 'string',
    'policy': 'string',
    'authorization': {
        'string': [
            'string',
        ]
    },
    'claims': {
        'string': 'string'
    }
}

Response Structure

  • (dict) --

    Represents the response of the test invoke request for a custom Authorizer

    • clientStatus (integer) --

      The HTTP status code that the client would have received. Value is 0 if the authorizer succeeded.

    • log (string) --

      The API Gateway execution log for the test authorizer request.

    • latency (integer) --

      The execution latency of the test authorizer request.

    • principalId (string) --

      The principal identity returned by the Authorizer

    • policy (string) --

      The JSON policy document returned by the Authorizer

    • authorization (dict) --

      • (string) --

        • (list) --

          • (string) --

    • claims (dict) --

      The open identity claims, with any supported custom attributes, returned from the Cognito Your User Pool configured for the API.

      • (string) --

        • (string) --

TestInvokeMethod (updated) Link ¶
Changes (both)
{'multiValueHeaders': {'string': ['string']}}

Simulate the execution of a Method in your RestApi with headers, parameters, and an incoming request body.

See also: AWS API Documentation

Request Syntax

client.test_invoke_method(
    restApiId='string',
    resourceId='string',
    httpMethod='string',
    pathWithQueryString='string',
    body='string',
    headers={
        'string': 'string'
    },
    multiValueHeaders={
        'string': [
            'string',
        ]
    },
    clientCertificateId='string',
    stageVariables={
        'string': 'string'
    }
)
type restApiId

string

param restApiId

[REQUIRED]

[Required] The string identifier of the associated RestApi.

type resourceId

string

param resourceId

[REQUIRED]

[Required] Specifies a test invoke method request's resource ID.

type httpMethod

string

param httpMethod

[REQUIRED]

[Required] Specifies a test invoke method request's HTTP method.

type pathWithQueryString

string

param pathWithQueryString

The URI path, including query string, of the simulated invocation request. Use this to specify path parameters and query string parameters.

type body

string

param body

The simulated request body of an incoming invocation request.

type headers

dict

param headers

A key-value map of headers to simulate an incoming invocation request.

  • (string) --

    • (string) --

type multiValueHeaders

dict

param multiValueHeaders

The headers as a map from string to list of values to simulate an incoming invocation request.

  • (string) --

    • (list) --

      • (string) --

type clientCertificateId

string

param clientCertificateId

A ClientCertificate identifier to use in the test invocation. API Gateway will use the certificate when making the HTTPS request to the defined back-end endpoint.

type stageVariables

dict

param stageVariables

A key-value map of stage variables to simulate an invocation on a deployed Stage.

  • (string) --

    • (string) --

rtype

dict

returns

Response Syntax

{
    'status': 123,
    'body': 'string',
    'headers': {
        'string': 'string'
    },
    'multiValueHeaders': {
        'string': [
            'string',
        ]
    },
    'log': 'string',
    'latency': 123
}

Response Structure

  • (dict) --

    Represents the response of the test invoke request in the HTTP method.

    Test API using the API Gateway console

    • status (integer) --

      The HTTP status code.

    • body (string) --

      The body of the HTTP response.

    • headers (dict) --

      The headers of the HTTP response.

      • (string) --

        • (string) --

    • multiValueHeaders (dict) --

      The headers of the HTTP response as a map from string to list of values.

      • (string) --

        • (list) --

          • (string) --

    • log (string) --

      The API Gateway execution log for the test invoke request.

    • latency (integer) --

      The execution latency of the test invoke request.