Skip to content

Autotask

flowtask.components.AutoTask

AutoTask

AutoTask(*args, **kwargs)

Bases: HTTPService, FlowComponent

AutoTask Component

Overview

This component retrieves data from AutoTask using the Autotask REST API.
It supports filtering data based on a query or specific IDs, handles pagination, and converts picklist values to human-readable labels.

.. table:: Properties
:widths: auto

+---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | Name | Required | Summary | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | credentials | Yes | Dictionary containing API credentials: "API_INTEGRATION_CODE", "USERNAME", and "SECRET". Credentials can be retrieved from environment variables. | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | zone | Yes | AutoTask zone (e.g., "na"). | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | entity | Yes | AutoTask entity to query (e.g., "tickets"). | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | query_json | No | JSON object representing the AutoTask query filter (defaults to retrieving all items). Refer to AutoTask documentation for query syntax. | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | id_column_name | No | Name of the column in the output DataFrame that should represent the AutoTask record ID (defaults to "id"). | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | ids | No | List of AutoTask record IDs to retrieve (overrides query_json filter if provided). | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | picklist_fields | No | List of picklist fields in the entity to be converted to human-readable labels. | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | user_defined_fields | No | List of user-defined fields in the entity to extract (requires "userDefinedFields" field in the response). | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | fillna_values | No | Default value to replace missing data (defaults to None). | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | map_field_type | No | Dictionary mapping field names to desired data types in the output DataFrame. | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+ | force_create_columns | No | If True, ensures "IncludeFields" columns always exist, even if empty. Must be used with "IncludeFields" in "query_json". | +---------------------------------+----------+-----------+---------------------------------------------------------------------------------------------------------------------------------------+

Returns a pandas DataFrame containing the retrieved AutoTask data and additional columns for picklist labels (if applicable).

Example:

AutoTask:
  skipError: skip
  credentials:
    API_INTEGRATION_CODE: AUTOTASK_API_INTEGRATION_CODE
    USERNAME: AUTOTASK_USERNAME
    SECRET: AUTOTASK_SECRET
  entity: TicketNotes
  zone: webservices14
  id_column_name: ticket_note_id
  picklist_fields:
  - noteType
  - publish
  ids: []
  query_json:
    IncludeFields:
    - id
    - createDateTime
    - createdByContactID
    - creatorResourceID
    - description
    - impersonatorCreatorResourceID
    - impersonatorUpdaterResourceID
    - lastActivityDate
    - noteType
    - publish
    - ticketID
    - title
    Filter:
    - op: gte
      field: lastActivityDate
      value: '{two_days_ago}'
  masks:
    '{two_days_ago}':
    - date_diff
    - value: current_date
      diff: 48
      mode: hours
      mask: '%Y-%m-%d %H:%M:%S'

extract_udf staticmethod

extract_udf(row)

Extracts dictionary values into columns