QlikElixir.REST.Automations (qlik_elixir v0.3.5)

View Source

REST API client for Qlik Cloud Automations.

Provides functions to manage automations (no-code workflows) including creating, running, and monitoring automation executions.

Examples

# List all automations
{:ok, %{"data" => automations}} = Automations.list(config: config)

# Get automation details
{:ok, automation} = Automations.get("auto-123", config: config)

# Enable/disable an automation
{:ok, automation} = Automations.enable("auto-123", config: config)
{:ok, automation} = Automations.disable("auto-123", config: config)

# Trigger a run
{:ok, run} = Automations.run("auto-123", config: config)

# List runs
{:ok, %{"data" => runs}} = Automations.list_runs("auto-123", config: config)

Summary

Functions

Changes the owner of an automation.

Moves an automation to another space.

Copies an automation.

Creates a new automation.

Deletes an automation.

Disables an automation.

Enables an automation.

Gets an automation by ID.

Gets details of a specific run.

Gets automation usage statistics.

Lists all automations.

Lists runs for an automation.

Triggers an automation run.

Stops a running automation.

Functions

change_owner(automation_id, owner_id, opts \\ [])

@spec change_owner(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Changes the owner of an automation.

Parameters

  • automation_id - The automation ID.
  • owner_id - The new owner's user ID.

change_space(automation_id, space_id, opts \\ [])

@spec change_space(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Moves an automation to another space.

Parameters

  • automation_id - The automation ID.
  • space_id - The target space ID.

copy(automation_id, opts \\ [])

@spec copy(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Copies an automation.

create(params, opts \\ [])

@spec create(
  map(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Creates a new automation.

Parameters

  • params - Map with automation details:
    • :name - Required. Automation name.
    • :workspace - Required. Automation workspace definition.

delete(automation_id, opts \\ [])

@spec delete(
  String.t(),
  keyword()
) :: :ok | {:error, QlikElixir.Error.t()}

Deletes an automation.

disable(automation_id, opts \\ [])

@spec disable(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Disables an automation.

enable(automation_id, opts \\ [])

@spec enable(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Enables an automation.

get(automation_id, opts \\ [])

@spec get(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Gets an automation by ID.

get_run(automation_id, run_id, opts \\ [])

@spec get_run(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Gets details of a specific run.

Parameters

  • automation_id - The automation ID.
  • run_id - The run ID.

get_usage(filter, opts \\ [])

@spec get_usage(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Gets automation usage statistics.

Requires TenantAdmin role.

Parameters

  • filter - Required SCIM-style filter expression. Supports:
    • name: Metric name ("runs", "scheduledRun", "triggeredRun", "webhookRuns", "duration", "bandwidthIn", "bandwidthOut")
    • date: Target date or range

Options

  • :breakdown_by - When set to "automation", results are segmented by automation.

Examples

# Get total runs for a date range
Automations.get_usage(~s(date ge "2025-01-01" and date le "2025-01-31"))

# Get specific metric
Automations.get_usage(~s(name eq "duration"))

# Get runs by automation
Automations.get_usage(~s(date ge "2025-01-01"), breakdown_by: "automation")

list(opts \\ [])

@spec list(keyword()) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Lists all automations.

Options

  • :config - Required. The configuration struct.
  • :limit - Maximum number of results per page.
  • :next - Cursor for pagination.
  • :name - Filter by name (partial match).
  • :state - Filter by state ("enabled", "disabled").

list_runs(automation_id, opts \\ [])

@spec list_runs(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Lists runs for an automation.

Options

  • :limit - Maximum number of results per page.
  • :next - Cursor for pagination.
  • :status - Filter by status.

retry_run(automation_id, run_id, opts \\ [])

@spec retry_run(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Retries a failed run.

Parameters

  • automation_id - The automation ID.
  • run_id - The run ID to retry.

run(automation_id, opts \\ [])

@spec run(
  String.t(),
  keyword()
) :: {:ok, map()} | {:error, QlikElixir.Error.t()}

Triggers an automation run.

Options

  • :inputs - Map of input parameters for the automation.

stop_run(automation_id, run_id, opts \\ [])

@spec stop_run(String.t(), String.t(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Stops a running automation.

Parameters

  • automation_id - The automation ID.
  • run_id - The run ID.

update(automation_id, params, opts \\ [])

@spec update(String.t(), map(), keyword()) ::
  {:ok, map()} | {:error, QlikElixir.Error.t()}

Updates an automation.

Note: Uses PUT for full replacement of the automation.

Parameters

  • automation_id - The automation ID.
  • params - Map with automation details.