test_invoke_method

APIGateway.Client.test_invoke_method(**kwargs)

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

See also: AWS API Documentation

Request Syntax

response = 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'
    }
)
Parameters
  • restApiId (string) --

    [REQUIRED]

    The string identifier of the associated RestApi.

  • resourceId (string) --

    [REQUIRED]

    Specifies a test invoke method request's resource ID.

  • httpMethod (string) --

    [REQUIRED]

    Specifies a test invoke method request's HTTP method.

  • pathWithQueryString (string) -- The URI path, including query string, of the simulated invocation request. Use this to specify path parameters and query string parameters.
  • body (string) -- The simulated request body of an incoming invocation request.
  • headers (dict) --

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

    • (string) --
      • (string) --
  • multiValueHeaders (dict) --

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

    • (string) --
      • (list) --
        • (string) --
  • clientCertificateId (string) -- 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.
  • stageVariables (dict) --

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

    • (string) --
      • (string) --
Return type

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.

    • 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.

Exceptions

  • APIGateway.Client.exceptions.BadRequestException
  • APIGateway.Client.exceptions.UnauthorizedException
  • APIGateway.Client.exceptions.NotFoundException
  • APIGateway.Client.exceptions.TooManyRequestsException