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

**********************
test_invoke_authorizer
**********************



.. py:method:: APIGateway.Client.test_invoke_authorizer(**kwargs)

  

  Simulate the execution of an Authorizer 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/TestInvokeAuthorizer>`_  


  **Request Syntax**
  ::

    response = 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]** 

    The string identifier of the associated RestApi.

    

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

    Specifies a test invoke authorizer request's Authorizer ID.

    

  
  :type headers: dict
  :param headers: 

    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: 

    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: 

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

    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, in ms, 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) --* 

        The authorization response.

        
        

        - *(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) --* 
    
  
  
  **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`

  