Sync Runs

A SyncRun represents a single execution (run) of a Sync job. It tracks status, statistics, logs, and timing for each sync operation.

List Sync Runs

SDK Method

syncrun.List()

Return Object

[]*SyncRun

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

SyncRunListParams Fields

FieldDescription
UserId
int64
User ID. Provide a value of 0 to operate the current session's user.

Additional Arguments

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    sync_run "github.com/Files-com/files-sdk-go/v3/syncrun"
)

syncRunIterator, err := sync_run.List(files_sdk.SyncRunListParams{UserId: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

for syncRunIterator.Next() {
    syncRun := syncRunIterator.syncRun()
}
err = syncRunIterator.Err()
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

Show Sync Run

SDK Method

syncrun.Find()

Return Object

SyncRun

Authorization Requirement

Requires either a Site-Wide API key or User API key or session from a User with Site Admin permissions.

SyncRunFindParams Fields

FieldDescription
Id
int64
Required
Sync Run ID.

Example Request

import (
    "fmt"
    "errors"

    files_sdk "github.com/Files-com/files-sdk-go/v3"
    sync_run "github.com/Files-com/files-sdk-go/v3/syncrun"
)

syncRun, err := sync_run.Find(files_sdk.SyncRunFindParams{Id: 1})
if err != nil {
    var respErr files_sdk.ResponseError
    if errors.As(err, &respErr) {
        fmt.Println("Response Error Occurred (" + respErr.Type + "): " + respErr.ErrorMessage)
    } else {
        fmt.Printf("Unexpected Error: %s\n", err.Error())
    }
}

The SyncRun Object

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

AttributeDescription
Id
int64
SyncRun ID
Body
string
Log or summary body for this run
BytesSynced
int64
Total bytes synced in this run
ComparedFiles
int64
Number of files compared
ComparedFolders
int64
Number of folders compared
CompletedAt
date-time
When this run was completed
CreatedAt
date-time
When this run was created
DestRemoteServerType
string
Destination remote server type, if any
Possible values: ftp, sftp, s3, google_cloud_storage, webdav, wasabi, backblaze_b2, one_drive, box, dropbox, google_drive, azure, sharepoint, s3_compatible, azure_files, files_agent, filebase, cloudflare, linode, files_com
DryRun
boolean
Whether this run was a dry run (no actual changes made)
ErroredFiles
int64
Number of files that errored
EstimatedBytesCount
int64
Estimated bytes count for this run
EventErrors
array(string)
Array of errors encountered during the run
LogUrl
string
Link to external log file.
Runtime
double
Total runtime in seconds
SiteId
int64
Site ID
WorkspaceId
int64
Workspace ID
SrcRemoteServerType
string
Source remote server type, if any
Possible values: ftp, sftp, s3, google_cloud_storage, webdav, wasabi, backblaze_b2, one_drive, box, dropbox, google_drive, azure, sharepoint, s3_compatible, azure_files, files_agent, filebase, cloudflare, linode, files_com
Status
string
Status of the sync run (success, failure, partial_failure, in_progress, skipped)
Possible values: success, failure, partial_failure, in_progress, skipped
SuccessfulFiles
int64
Number of files successfully synced
SyncId
int64
ID of the Sync this run belongs to
SyncName
string
Name of the Sync this run belongs to
UpdatedAt
date-time
When this run was last updated
LiveTransfers
array(object)
Array of in-progress file transfers with progress data. Only present when the sync run status is in_progress.