:doc:`MWAA <../../mwaa>` / Client / invoke_rest_api

***************
invoke_rest_api
***************



.. py:method:: MWAA.Client.invoke_rest_api(**kwargs)

  

  Invokes the Apache Airflow REST API on the webserver with the specified inputs. To learn more, see `Using the Apache Airflow REST API <https://docs.aws.amazon.com/mwaa/latest/userguide/access-mwaa-apache-airflow-rest-api.html>`__

  

  See also: `AWS API Documentation <https://docs.aws.amazon.com/goto/WebAPI/mwaa-2020-07-01/InvokeRestApi>`_  


  **Request Syntax**
  ::

    response = client.invoke_rest_api(
        Name='string',
        Path='string',
        Method='GET'|'PUT'|'POST'|'PATCH'|'DELETE',
        QueryParameters={...}|[...]|123|123.4|'string'|True|None,
        Body={...}|[...]|123|123.4|'string'|True|None
    )
    
  :type Name: string
  :param Name: **[REQUIRED]** 

    The name of the Amazon MWAA environment. For example, ``MyMWAAEnvironment``.

    

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

    The Apache Airflow REST API endpoint path to be called. For example, ``/dags/123456/clearTaskInstances``. For more information, see `Apache Airflow API <https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html>`__

    

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

    The HTTP method used for making Airflow REST API calls. For example, ``POST``.

    

  
  :type QueryParameters: :ref:`document<document>`
  :param QueryParameters: 

    Query parameters to be included in the Apache Airflow REST API call, provided as a JSON object.

    

  
  :type Body: :ref:`document<document>`
  :param Body: 

    The request body for the Apache Airflow REST API call, provided as a JSON object.

    

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

    
    ::

      {
          'RestApiStatusCode': 123,
          'RestApiResponse': {...}|[...]|123|123.4|'string'|True|None
      }
      
    **Response Structure**

    

    - *(dict) --* 
      

      - **RestApiStatusCode** *(integer) --* 

        The HTTP status code returned by the Apache Airflow REST API call.

        
      

      - **RestApiResponse** (:ref:`document<document>`) -- 

        The response data from the Apache Airflow REST API call, provided as a JSON object.

        
  
  **Exceptions**
  
  *   :py:class:`MWAA.Client.exceptions.RestApiClientException`

  
  *   :py:class:`MWAA.Client.exceptions.AccessDeniedException`

  
  *   :py:class:`MWAA.Client.exceptions.ResourceNotFoundException`

  
  *   :py:class:`MWAA.Client.exceptions.ValidationException`

  
  *   :py:class:`MWAA.Client.exceptions.InternalServerException`

  
  *   :py:class:`MWAA.Client.exceptions.RestApiServerException`

  