:doc:`APIGateway <../../apigateway>` / Client / test_invoke_method

******************
test_invoke_method
******************



.. py: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 <https://docs.aws.amazon.com/goto/WebAPI/apigateway-2015-07-09/TestInvokeMethod>`_  


  **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'
        }
    )
    
  :type restApiId: string
  :param restApiId: **[REQUIRED]** 

    The string identifier of the associated RestApi.

    

  
  :type resourceId: string
  :param resourceId: **[REQUIRED]** 

    Specifies a test invoke method request's resource ID.

    

  
  :type httpMethod: string
  :param httpMethod: **[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.

      
      

      - **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, in ms, of the test invoke request.

        
  
  **Exceptions**
  
  *   :py:class:`APIGateway.Client.exceptions.BadRequestException`

  
  *   :py:class:`APIGateway.Client.exceptions.UnauthorizedException`

  
  *   :py:class:`APIGateway.Client.exceptions.NotFoundException`

  
  *   :py:class:`APIGateway.Client.exceptions.TooManyRequestsException`

  