Automation Versions

An AutomationVersion is an immutable revision of an Automation v2 graph. Each saved graph change creates a revision. Restoring a revision saves its definition as a new current revision and keeps existing runs and Run Automation nodes pinned to their selected revisions.

List Automation Versions

SDK Method

automation_version.List()

Return Values

Returns a *automation_version.Iter and an error. Range over All() to receive files_sdk.AutomationVersion values and errors. Check each loop error before using its resource. Next() and Err() remain supported.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

AutomationVersionListParams Fields

FieldDescription
AutomationId
int64
Required
ID of the Automation that owns this revision.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    automation_version "github.com/Files-com/files-sdk-go/v3/automationversion"
)

automationVersionIterator, err := automation_version.List(files_sdk.AutomationVersionListParams{AutomationId: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}

for automationVersion, err := range automationVersionIterator.All() {
    if err != nil {
        var respErr files_sdk.ResponseError
        if errors.As(err, &respErr) {
            fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
        } else {
            fmt.Printf("Request failed: %v\n", err)
        }
        return
    }
    fmt.Println(automationVersion)
}

Show Automation Version

SDK Method

automation_version.Find()

Return Values

Returns a files_sdk.AutomationVersion value and an error.

Authorization Requirement

Requires a Site-Wide API key, or a User API key or session from a Site Administrator or a Workspace Administrator for the relevant workspace.

AutomationVersionFindParams Fields

FieldDescription
Id
int64
Required
Automation Version ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    automation_version "github.com/Files-com/files-sdk-go/v3/automationversion"
)

automationVersion, err := automation_version.Find(files_sdk.AutomationVersionFindParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Printf("API error (%s): %s\n", respErr.Type, respErr.ErrorMessage)
    } else {
        fmt.Printf("Request failed: %v\n", err)
    }
    return
}
fmt.Println(automationVersion)

The AutomationVersion Object

Some of the methods above return a AutomationVersion object. The attributes of this object are listed below.

AttributeDescription
Id
int64
Automation revision ID.
AutomationId
int64
ID of the Automation that owns this revision.
WorkspaceId
int64
Workspace that owns the Automation. Zero is the Default Workspace.
Version
int64
Revision number within the Automation.
CreatedAt
date-time
Time the revision was saved.
UserId
int64
ID of the user who saved the revision, when available.
Username
string
Username recorded when the revision was saved, when available.
ApiKeyId
int64
ID of the API key used to save the revision, when available.
Definition
object
Saved Automation v2 graph definition. Included when retrieving a single revision.

definition

Automation v2 workflow graph. Nodes define triggers, actions, and control flow; edges connect node IDs.

AttributeDescription
schema_version
integer
Required
Automation definition schema version. Value: 1.
nodes
array of objects
Required
Flat list of nodes. Every node requires a unique id and a type, accepts the node-specific config fields documented below, and action or control-flow nodes may set return to true to include their output in the Automation result. From 1 to 50 items.
edges
array of objects
Required
Directed connections between nodes.

Example definition

{
  "schema_version": 1,
  "nodes": [
    {
      "id": "trigger",
      "type": "trigger_manual"
    },
    {
      "id": "create_reports",
      "type": "create_folder",
      "config": {
        "destinations": [
          "reports/"
        ]
      }
    }
  ],
  "edges": [
    {
      "from": "trigger",
      "to": "create_reports"
    }
  ]
}

Edge fields

Trigger nodes

Action nodes

Control-flow nodes