:doc:`AppSync <../../appsync>` / Client / evaluate_mapping_template

*************************
evaluate_mapping_template
*************************



.. py:method:: AppSync.Client.evaluate_mapping_template(**kwargs)

  

  Evaluates a given template and returns the response. The mapping template can be a request or response template.

   

  Request templates take the incoming request after a GraphQL operation is parsed and convert it into a request configuration for the selected data source operation. Response templates interpret responses from the data source and map it to the shape of the GraphQL field output type.

   

  Mapping templates are written in the Apache Velocity Template Language (VTL).

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/appsync-2017-07-25/EvaluateMappingTemplate>`_  


  **Request Syntax**
  ::

    response = client.evaluate_mapping_template(
        template='string',
        context='string'
    )
    
  :type template: string
  :param template: **[REQUIRED]** 

    The mapping template; this can be a request or response template. A ``template`` is required for this action.

    

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

    The map that holds all of the contextual information for your resolver invocation. A ``context`` is required for this action.

    

  
  
  :rtype: dict
  :returns: 
    
    **Response Syntax**

    
    ::

      {
          'evaluationResult': 'string',
          'error': {
              'message': 'string'
          },
          'logs': [
              'string',
          ],
          'stash': 'string',
          'outErrors': 'string'
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **evaluationResult** *(string) --* 

        The mapping template; this can be a request or response template.

        
      

      - **error** *(dict) --* 

        The ``ErrorDetail`` object.

        
        

        - **message** *(string) --* 

          The error payload.

          
    
      

      - **logs** *(list) --* 

        A list of logs that were generated by calls to ``util.log.info`` and ``util.log.error`` in the evaluated code.

        
        

        - *(string) --* 
    
      

      - **stash** *(string) --* 

        An object available inside each resolver and function handler. A single ``stash`` object lives through a single resolver run. Therefore, you can use the stash to pass arbitrary data across request and response handlers and across functions in a pipeline resolver.

        
      

      - **outErrors** *(string) --* 

        The list of runtime errors that are added to the GraphQL operation response.

        
  
  **Exceptions**
  
  *   :py:class:`AppSync.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`AppSync.Client.exceptions.InternalFailureException`

  
  *   :py:class:`AppSync.Client.exceptions.BadRequestException`

  