CLI: Configuration



On This Page

 


The CLI references “skysync.” This is expected.

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

1 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

1 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

1 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

1 skysync-cli connections list

Contents of skysync-cli.json

1 2 3 { "output-json": true, }

 

Package Configuration

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

parameter

description

required

default

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

1 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

1 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

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

1 skysync-cli connections list

Command with output-json parameter

1 skysync-cli connections list --output-json=false

Command with json parameter

1 skysync-cli connections list --json=false

Example results

1 2 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

1 skysync-cli connections list --output-json=true

Command with json parameter

1 skysync-cli connections list --json=true

Command with json parameter

1 skysync-cli connections list --json

Example results

1 2 3 4 5 6 7 8 9 10 [ { "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

1 skysync-cli connections list

Contents of skysync-cli.json

1 2 3 { "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

1 skysync-cli connections list

 

Environment Variable Name

Value

Environment Variable Name

Value

SKYSYNC_output-json

true | false

 

Errors

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

Error Message

Remediation

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