Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

aligncenter

...

On This Page

Table of Contents

...

Command Format

The format of the request consists of following three parts.  

skysync-cli

The name of the package

command(s)

The name of the command to run, ie. connections, jobs, sites

parameters

Any command parameters to be passed in, ie. json, server, username, password

The parameters can be passed in on the command line itself using an equal sign or a space, or through a JSON file.  In the following examples, the authentication method being used is the skysync-cli.json method.  See the authentication section.

Example 1: Parameter values passed in using the equal sign

In this example, skysync-cli is the package, connections list are the commands and output-json is the parameter being passed in.  Note that the parameter output-json is preceded by two dashes and is followed by an equal sign before the parameter value of false.

Example using equal sign to pass in parameter value

Code Block
skysync-cli connections list --output-json=false

Example 2: Parameter values passed in using the space

In this example, skysync-cli is the package, connections list are the commands and output-json is the parameter being passed in.  Note that the parameter output-json is preceded by two dashes and is followed by a space before the parameter value of false.

Example using space to pass in parameter value

Code Block
skysync-cli connections list --output-json false

Example 3: Parameter with default --json parameter

In this example, skysync-cli is the package, connections list are the commands and json is the parameter being passed in.  Note that the parameter json is preceded by two dashes and is not followed by a parameter value. The default value in this case is true.

Example using --json parameter without values

Code Block
skysync-cli connections list --json

Example 4: Parameter values passed in using a JSON file

In this example, skysync-cli is the package, connections list are the commands and the output-json parameter is not part of the command but rather specified within the skysync-cli.json file within the same directory as the other skysync-cli files.  

Command

Code Block
skysync-cli connections list

Contents of skysync-cli.json

Code Block
{
	"output-json": true,
}

Package Configuration

The package configuration file can be specified using the config parameter.

parameter

description

required

default

config

Path to JSON config file

optional

skysync-cli.json within the current directory

In the following examples, the authentication parameters are provided within the configuration file.  See the authentication section.

Example 1: Configuration file location specified using a relative path

This example demonstrates how to specify the configuration file using a relative path.

Example with relative path

Code Block
skysync-cli connections list --config=config/testConfig.json

Example 2: Configuration file location specified using an absolute path

This example demonstrates how to specify the configuration file using a relative path.

Example with relative path

Code Block
skysync-cli connections list --config=c:/config/testConfig.json

Response Formats

Responses from the server can come in two formats, the default format (which is a table) or json (which needs to be specified on the command line or within the configuration file). The command to list the connections will be used to demonstrate the output formats.

parameter

description

required

default

output-json, json

Output results as JSON

optional

false

In the following examples, the authentication parameters are provided within the configuration file.  See the authentication section.

Example 1: Default format

In this example, the default response format is requested.  The following three commands will produce the same result.

Command with default output format

Code Block
skysync-cli connections list

Command with output-json parameter

Code Block
skysync-cli connections list --output-json=false

Command with json parameter

Code Block
skysync-cli connections list --json=false

Example results

Code Block
ID                               Name        Platform    Enabled
5dc531df34554edd96c31272262ad950 My Computer My Computer true

Example 2: JSON format

In this example, the JSON format is requested for the response.  The following two commands will produce the same result.

Command with output-json parameter

Code Block
skysync-cli connections list --output-json=true

Command with json parameter

Code Block
skysync-cli connections list --json=true

Command with json parameter

Code Block
skysync-cli connections list --json

Example results

Code Block
[
  {
    "id": "5dc531df34554edd96c31272262ad950",
    "name": "My Computer",
    "platform": {
      "name": "My Computer",
      "id": "fs"
    }
  }
]

Example 3: Specify response format within the configuration file

The response format parameter can be specified within the configuration file along with any authentication parameters.  In the following examples, the authentication parameters are provided within the configuration file.  See the authentication section.  In this example, the response is requested in JSON format.

Command

Code Block
skysync-cli connections list

Contents of skysync-cli.json

Code Block
{
	"output-json": true,
}

Example 4: Specify response format by environment variable

The response format parameter can be specified within an environment variable.  In the following examples, the authentication parameters are provided within the configuration file.  See the authentication section.

Command

Code Block
skysync-cli connections list

Environment Variable Name

Value

SKYSYNC_output-json

true | false

Errors

You may encounter errors while using the SkySync CLI.  Listed below are a few common errors and likely causes.

Error Message

Remediation

A valid Bearer token must be provided

Check that the username and password are valid and passed in properly

getaddrinfo ENOTFOUND

Check that the server and port are correct

connect ECONNREFUSED

Check that the server and port are correct