CLI: Connections



On This Page

 


The CLI references “skysync.” This is expected.

Connections

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

List the Connections

parameter

description

required

default

parameter

description

required

default

platform, p

Storage platform

optional

 

search, q

Search text

optional

 

active

Only retrieve active connections

optional

 

pools

Only retrieve connection pools. If this switch is not included, both connections and connection pools will be returned

optional

 

offset

Search offset

optional

0

limit

Search page size

optional

20

 

Example 1: List all the connections

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  

Command

1 skysync-cli connections list

Example Results

1 2 3 ID Name Platform Enabled IsPool PoolName 5dc531df34554edd96c31272262ad950 My Computer My Computer true TestPool d8b3254ad46c4aa4929f478dd0d3c51d TestPool My Computer true true

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 [ { "id": "5dc531df34554edd96c31272262ad950", "name": "My Computer", "platform": { "name": "My Computer", "id": "fs" }, "pool": { "name": "TestPool", "id": "d8b3254ad46c4aa4929f478dd0d3c51d" } }, { "id": "d8b3254ad46c4aa4929f478dd0d3c51d", "name": "TestPool", "platform": { "name": "My Computer", "id": "fs" }, "group": true } ]

 

Example 2: List Box connections

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  

Command

1 skysync-cli connections list -p box

 

Example 3: List active connections

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  

Command

1 skysync-cli connections list --active

 

Example 4: List connections with "test" in their name

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  

Command

1 skysync-cli connections list --search test

Command

1 skysync-cli connections list -q "test"

 

Example 5: List the connections skipping the first 5

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  

Command

1 skysync-cli connections list --offset=5

 

Show a Connection

This command will show the details of the specified connection.

parameter

description

required

default

parameter

description

required

default

id

The ID of the connection for which details will be shown

required

 

 

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections show {{id}}

Command with Example Values

1 skysync-cli connections show 5dc531df34554edd96c31272262ad950

Example Results

1 2 3 4 5 ID       5dc531df34554edd96c31272262ad950 Name     My Computer Platform My Computer Account Enabled  true

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [   {     "id": "5dc531df34554edd96c31272262ad950",     "name": "My Computer",     "platform": {       "name": "My Computer",       "id": "fs"     }   } ]

 

If the ID entered does not correspond to an existing connection, for example, if the connection was already deleted, the expected output is the following.

Expected Results

1 2 3 4 5 ID Name Platform Account Enabled true

Expected Results (JSON)

1 null

 

List the Platforms

The platform ID is required to create a connection.  To retrieve the full list of available platforms, run the following command.  In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.

Command

1 skysync-cli connections platforms

Example Results

1 2 3 4 5 6 7 8 ID Name Enabled box Box Y fs My Computer Y nfs Network File System Y onedrive Microsoft OneDrive Y sharepoint Microsoft SharePoint Y onedrive-business Microsoft OneDrive for Business Y office365 Microsoft Office 365 Y

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [ { "id": "box", "name": "Box" }, { "id": "fs", "name": "My Computer" }, { "id": "nfs", "name": "Network File System" }, { "id": "onedrive", "name": "Microsoft OneDrive" }, { "id": "sharepoint", "name": "Microsoft SharePoint" }, { "id": "onedrive-business", "name": "Microsoft OneDrive for Business" }, { "id": "office365", "name": "Microsoft Office 365" } ]

 

Show a Platform

This command will show the details of the specified platform.

parameter

description

required

default

parameter

description

required

default

id

The ID of the connection for which details will be shown

required

 

 

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections platforms {{id}}

Command with Example Values

1 skysync-cli connections platforms nfs

Example Results

1 2 3 ID nfs Name Network File System Enabled Y

Example Results (JSON)

1 2 3 4 5 6 [ { "id": "nfs", "name": "Network File System" } ]

 

Create a Connection

This command provides the ability to create a connection.

parameter

description

required

default

parameter

description

required

default

platform, p

Storage platform

required

 

name

Connection name

optional

 

auth-input, in

Read authentication JSON from stdin

optional

false

auth-file, file

The authentication JSON file

optional

 

 

Example 1: Create a Box connection providing the authentication from the stdin

In this example, a connection to Box will be created. The command below returns a link you need to open in a Web browser. This will take you to the Box login page where you will provide the authentication information and grant SkySync access to the account. Once you grant the authorization, the new connection will exist in the Connections list.

Command with Variables

1 skysync-cli connections add --platform=box --name=BoxConnection1


Box Login

 

Example 2: Create an NFS connection providing the authentication from a file

In this example, a connection to a network file system will be created providing the authentication from a JSON file.  The authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections add --platform=nfs --name={{optionalConnectionName}} --auth-file={{authFile}}.json

Command with Example Values

1 skysync-cli connections add --platform=nfs --name=NFSConnection2 --auth-file=NFSConnection2.json

Contents of NFSConnection2.json

1 2 3 4 5 6 { "username": "{{username}}", "password": "{{password}}", "uri": "\\\\{{serverName}}\\{{shareName}}", "versioning": true }

Note that the uri has the backslashes escaped.  

 

Example Results

1 2 3 4 ID 213e6621d3594903b73d0799abde09e6 Name NFSConnection2 Platform Network File System Enabled true

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 [ { "id": "86e7c5c398fd4607a28dbbff80c69849", "name": "NFSConnection2", "platform": { "name": "Network File System", "id": "nfs" } } ]

 

Example 3: Create a Box connection providing the authentication from a file

In this example, a connection to Box will be created providing the authentication from a JSON file.  The authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections add --platform=box --name={{optionalConnectionName}} --auth-file={{authFile}}.json

Command with Example Values

1 skysync-cli connections add --platform=box --name=BoxConnection2 --auth-file=connections/BoxConnection2.json

 

To utilize Box Authentication via a Box Service Account, follow the steps outline at Creating a Box (Service Account)

Contents of BoxConnection2.json

1 2 3 4 5 6 7 8 { "public_key_id": "{{boxPublicKey}}", "client_id": "{{boxClientID}}", "client_secret": "{{boxClientSecret}}", "user_id": "{{boxUserId}}", "password": "{{boxPassword}}", "private_key": "{{boxPrivateKey}}" }

Example Results

1 2 3 4 ID 75268591b32b46f2895fb97a368701be Name BoxConnection2 Platform Box Enabled true

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 [ { "id": "75268591b32b46f2895fb97a368701be", "name": "BoxConnection2", "platform": { "name": "Box", "id": "box" } } ]

 

Example 4: Create a OneDrive for Business connection providing the authentication from a file

In this example, a connection to OneDrive for Business will be created providing the authentication from a JSON file.  The authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections add -p onedrive-business --name {{optionalConnectionName}} --auth-file {{authFile}}.json

Command with Example Values

1 skysync-cli connections add -p onedrive-business --name ODFBConnection1 --auth-file connections/odfb-connection-1.json

Contents of odfb-connection-1.json

1 2 3 4 5 6 { "username": "{{odfb-username}}", "password": "{{odfb-password}}", "uri": "{{odfb-uri}}", "versioning": true }

The URI contains a portion of the username.  Ensure you specify the correct URI to obtain expected results.

 

Example Contents of odfb-connection-1.json

1 2 3 4 5 6 { "username": "user@example.onmicrosoft.com", "password": "user-odfb-password", "uri": "https://example-my.sharepoint.com/personal/user_example_onmicrosoft_com", "versioning": true }

Example Results

1 2 3 4 ID cda8231a40364724bc8581a264670e09 Name Microsoft OneDrive for Business (https://example-my.sharepoint.com/personal/user_example_onmicrosoft_com/) Platform Microsoft OneDrive for Business Enabled true

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 [ { "id": "cda8231a40364724bc8581a264670e09", "name": "Microsoft OneDrive for Business (https://example-my.sharepoint.com/personal/user_example_onmicrosoft_com/)", "platform": { "name": "Microsoft OneDrive for Business", "id": "onedrive-business" } } ]

 

Example 5: Create a Syncplicity connection providing the authentication from a file

In this example, a connection to Syncplicity will be created providing the authentication from a JSON file.  The authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections add -p syncplicity --name {{optionalConnectionName}} --auth-file {{authFile}}.json

Command with Examples

1 skysync-cli connections add -p syncplicity --name SyncplicityConnection1 --auth-file connections/syncplicity-connection-1.json

Contents of syncplicity-connection-1.json

1 2 3 4 5 6 { "client_id": "{{syncplicity_client_id}}", "client_secret": "{{syncplicity_client_secret}}", "app_token": "{{syncplicity_app_token}}", "admin_mode": "{{admin_mode}}" }

The admin_mode parameter is optional and should be set to true if admin mode is desired.

 

Example Results

1 2 3 4 ID cda8231a40364724bc8581a264670e09 Name SyncplicityConnection1 Platform Syncplicity Enabled true

Example Results (JSON)

1 2 3 4 5 6 7 8 9 10 [ { "id": "cda8231a40364724bc8581a264670e09", "name": "SyncplicityConnection1", "platform": { "name": "Syncplicity", "id": "syncplicity" } } ]

 

Add a Connection to a Connection Pool

This command assigns a connection to a connection pool.  A connection can only be assigned to one pool.  If the connection was previously assigned to a different pool, running this command with a different pool will cause it to be removed from the original pool.

parameter

description

required

parameter

description

required

id

ID of the connection to be assigned to a pool

required

name

Name of new or existing connection pool

optional

pool

ID of an existing connection pool

optional

 

Command

1 skysync-cli connections pool assign {id} [name] [pool]

 

Example 1: Assign a connection to a new or existing connection pool by name

If the named connection pool does not already exist, it will first be created.

Command with Example Values

1 skysync-cli connections pool assign 5dc531df34554edd96c31272262ad950 --name TestPool

 

Example 2: Assign a connection to an existing connection pool by id

If a connection pool does not exist with the specified id, an error will be thrown.

Command with Example Values

1 skysync-cli connections pool assign 5dc531df34554edd96c31272262ad950 --pool d8b3254ad46c4aa4929f478dd0d3c51d

 

Remove a Connection from a Connection Pool

This command removes a connection from a connection pool.  Connection pool information does not need to be specified.  Once this command is run, the connection will not be attached to any pools.

parameter

description

required

parameter

description

required

id

ID of the connection to be removed from a connection pool

required

 

Command

1 skysync-cli connections pool unassign {id}

Command with Example Values

1 skysync-cli connections pool unassign 5dc531df34554edd96c31272262ad950

 

Delete a Connection

This command will delete the specified connection

parameter

description

required

default

parameter

description

required

default

id

The ID of the connection to be deleted

required

 

 

In the following example, the authentication parameters are provided within the configuration file.  See the authentication section for more information.  The parameters within the two curly braces (including the braces) will need to be replaced with valid values.

Command with Variables

1 skysync-cli connections delete {{id}}

Command with Example Values

1 skysync-cli connections delete 5dc531df34554edd96c31272262ad950

 

If the ID entered does not correspond to an existing connection, for example, if the connection was already deleted, the expected output is the following.

Expected Results

1 The connection could not be deleted.

 

The response is only available in the default format.  If JSON output is specified, no output will be provided.