| # airflow_client.client.TaskApi | |
| All URIs are relative to *http://localhost* | |
| Method | HTTP request | Description | |
| ------------- | ------------- | ------------- | |
| [**get_task**](TaskApi.md#get_task) | **GET** /api/v2/dags/{dag_id}/tasks/{task_id} | Get Task | |
| [**get_tasks**](TaskApi.md#get_tasks) | **GET** /api/v2/dags/{dag_id}/tasks | Get Tasks | |
| # **get_task** | |
| > TaskResponse get_task(dag_id, task_id) | |
| Get Task | |
| Get simplified representation of a task. | |
| ### Example | |
| * OAuth Authentication (OAuth2PasswordBearer): | |
| * Bearer Authentication (HTTPBearer): | |
| ```python | |
| import airflow_client.client | |
| from airflow_client.client.models.task_response import TaskResponse | |
| from airflow_client.client.rest import ApiException | |
| from pprint import pprint | |
| # Defining the host is optional and defaults to http://localhost | |
| # See configuration.py for a list of all supported configuration parameters. | |
| configuration = airflow_client.client.Configuration( | |
| host = "http://localhost" | |
| ) | |
| # The client must configure the authentication and authorization parameters | |
| # in accordance with the API server security policy. | |
| # Examples for each auth method are provided below, use the example that | |
| # satisfies your auth use case. | |
| configuration.access_token = os.environ["ACCESS_TOKEN"] | |
| # Configure Bearer authorization: HTTPBearer | |
| configuration = airflow_client.client.Configuration( | |
| access_token = os.environ["BEARER_TOKEN"] | |
| ) | |
| # Enter a context with an instance of the API client | |
| with airflow_client.client.ApiClient(configuration) as api_client: | |
| # Create an instance of the API class | |
| api_instance = airflow_client.client.TaskApi(api_client) | |
| dag_id = 'dag_id_example' # str | | |
| task_id = None # object | | |
| try: | |
| # Get Task | |
| api_response = api_instance.get_task(dag_id, task_id) | |
| print("The response of TaskApi->get_task:\n") | |
| pprint(api_response) | |
| except Exception as e: | |
| print("Exception when calling TaskApi->get_task: %s\n" % e) | |
| ``` | |
| ### Parameters | |
| Name | Type | Description | Notes | |
| ------------- | ------------- | ------------- | ------------- | |
| **dag_id** | **str**| | | |
| **task_id** | [**object**](.md)| | | |
| ### Return type | |
| [**TaskResponse**](TaskResponse.md) | |
| ### Authorization | |
| [OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer), [HTTPBearer](../README.md#HTTPBearer) | |
| ### HTTP request headers | |
| - **Content-Type**: Not defined | |
| - **Accept**: application/json | |
| ### HTTP response details | |
| | Status code | Description | Response headers | | |
| |-------------|-------------|------------------| | |
| **200** | Successful Response | - | | |
| **400** | Bad Request | - | | |
| **401** | Unauthorized | - | | |
| **403** | Forbidden | - | | |
| **404** | Not Found | - | | |
| **422** | Validation Error | - | | |
| [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) | |
| # **get_tasks** | |
| > TaskCollectionResponse get_tasks(dag_id, order_by=order_by) | |
| Get Tasks | |
| Get tasks for Dag. | |
| ### Example | |
| * OAuth Authentication (OAuth2PasswordBearer): | |
| * Bearer Authentication (HTTPBearer): | |
| ```python | |
| import airflow_client.client | |
| from airflow_client.client.models.task_collection_response import TaskCollectionResponse | |
| from airflow_client.client.rest import ApiException | |
| from pprint import pprint | |
| # Defining the host is optional and defaults to http://localhost | |
| # See configuration.py for a list of all supported configuration parameters. | |
| configuration = airflow_client.client.Configuration( | |
| host = "http://localhost" | |
| ) | |
| # The client must configure the authentication and authorization parameters | |
| # in accordance with the API server security policy. | |
| # Examples for each auth method are provided below, use the example that | |
| # satisfies your auth use case. | |
| configuration.access_token = os.environ["ACCESS_TOKEN"] | |
| # Configure Bearer authorization: HTTPBearer | |
| configuration = airflow_client.client.Configuration( | |
| access_token = os.environ["BEARER_TOKEN"] | |
| ) | |
| # Enter a context with an instance of the API client | |
| with airflow_client.client.ApiClient(configuration) as api_client: | |
| # Create an instance of the API class | |
| api_instance = airflow_client.client.TaskApi(api_client) | |
| dag_id = 'dag_id_example' # str | | |
| order_by = 'task_id' # str | (optional) (default to 'task_id') | |
| try: | |
| # Get Tasks | |
| api_response = api_instance.get_tasks(dag_id, order_by=order_by) | |
| print("The response of TaskApi->get_tasks:\n") | |
| pprint(api_response) | |
| except Exception as e: | |
| print("Exception when calling TaskApi->get_tasks: %s\n" % e) | |
| ``` | |
| ### Parameters | |
| Name | Type | Description | Notes | |
| ------------- | ------------- | ------------- | ------------- | |
| **dag_id** | **str**| | | |
| **order_by** | **str**| | [optional] [default to 'task_id'] | |
| ### Return type | |
| [**TaskCollectionResponse**](TaskCollectionResponse.md) | |
| ### Authorization | |
| [OAuth2PasswordBearer](../README.md#OAuth2PasswordBearer), [HTTPBearer](../README.md#HTTPBearer) | |
| ### HTTP request headers | |
| - **Content-Type**: Not defined | |
| - **Accept**: application/json | |
| ### HTTP response details | |
| | Status code | Description | Response headers | | |
| |-------------|-------------|------------------| | |
| **200** | Successful Response | - | | |
| **400** | Bad Request | - | | |
| **401** | Unauthorized | - | | |
| **403** | Forbidden | - | | |
| **404** | Not Found | - | | |
| **422** | Validation Error | - | | |
| [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) | |