CLI: Templates



On This Page


The CLI references “skysync.” This is expected.

Templates

List Templates

parameter

description

required

default

parameter

description

required

default

kind

Job Template Kind

optional



search, q

Search text

optional



active

Only retrieve active job templates

optional



offset

Search offset

optional

0

limit

Search page size

optional

20

Example 1: List all the job templates

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

Command

1 skysync-cli templates list

Example results

1 2 3 ID Name Kind Enabled 382d78ab17784b6bb14844ba1ea819bc Example template 1 transfer true 8c92e69280b74d1aa8c66e6c992ac475 Example template 2 transfer true

Example results (JSON)

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 [ { "id": "382d78ab17784b6bb14844ba1ea819bc", "name": "Example template 1", "kind": "transfer", "disabled": false, "schedule": { "mode": "manual" } }, { "id": "8c92e69280b74d1aa8c66e6c992ac475", "name": "Example template 2", "kind": "transfer", "disabled": false, "schedule": { "mode": "manual" } } ]

 

Example 2: List transfer job templates

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

Command

1 skysync-cli templates list --kind transfer

 

Example 3: List active job templates

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

Command

1 skysync-cli templates list --active

 

Example 4: List job templates 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 templates list --search test

Command

1 skysync-cli templates list -q "test"

 

Example 5: List the job templates 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 templates list --offset=5

 

Show a Job Template

This command will show the details of the specified job template.

parameter

description

required

default

parameter

description

required

default

id

The ID of the job template 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 templates show {{id}}

Command with example values

1 skysync-cli templates show 382d78ab17784b6bb14844ba1ea819bc

Example results

1 2 3 4 ID 382d78ab17784b6bb14844ba1ea819bc Name Example template 1 Kind transfer Enabled 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 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 [ { "id": "382d78ab17784b6bb14844ba1ea819bc", "name": "Example template 1", "kind": "transfer", "disabled": false, "schedule": { "mode": "manual" }, "transfer": { "source": { "options": null, "connection": { "id": "df48c59e4bb54a66bccf2270b316bd71", "name": "Box Connection", "platform": { "id": "box", "type": "platform" }, "disabled": true, "type": "connection" }, "target": { "item": { "parent": { "root": true, "name": "Libraries" }, "name": "Documents" } } }, "destination": { "options": null, "connection": { "id": "df48c59e4bb54a66bccf2270b316bd71", "name": "Box Connection", "platform": { "id": "box", "type": "platform" }, "disabled": true, "type": "connection" }, "target": { "item": { "root": true, "name": "transfer_destination" } } }, "transfer_type": "copy", "audit_level": "trace", "type": "transfer" } } ]

 

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

Expected results

1 2 3 4 ID Name Kind Enabled true

Expected results (JSON)

1 null

 

Create a Job Template

This command will create a template.

parameter

description

required

default

parameter

description

required

default

kind

The job template kind

required

transfer

name

The job template name

optional



auto

Schedule the job as automatic

optional

true

manual

Schedule the job as manual

optional

false

options-input, in

Read JSON options from stdin





options-file, file

The options JSON file





 

If both auto and manual are set to true, the job will be created to run manually.

 

To create a job template that imports permissions or metadata, use the below examples in conjunction with the documentation for the permissions import or the metadata import.

 

Example 1: Creating a job template providing the options from the stdin

This feature is available only with scripting such as within a PowerShell or Node script.  In this example, the the template will be created by providing the JSON contents as a parameter and the schedule will be set to manual.  The authentication parameters are provided within the configuration file.  See the authentication section for more information.  

This feature is not supported from a standard terminal such as a command line; however, piping may be utilized to pass in the json option block via Node or PowerShell. See example below.


Command with variables (PowerShell)

1 '{"source": {"connection": {"id": "{{sourceConnectionId"}, "target": {"path": "{{sourcePath}}"}}, "destination": {"connection": {"id": "{{destinationConnectionId"}, "target": {"path": "{{destinationPath}}"}}}' | skysync-cli templates add --manual --in --name="Example Template"

Sample expected results

1 2 3 4 ID 8b9ea3d812e24d7892d88d63acb40402 Name : to Kind transfer Enabled true

 

Example 2: Creating a job template providing the options from a file

In this example, the the template will be created by providing the location of the JSON options file and the schedule will be set to manual.  The authentication parameters are provided within the configuration file.  See the authentication section for more information.  

Command

1 skysync-cli templates add --name="Example Template" --manual --options-file=templateOptions.JSON

Contents of templateOptions.json with variables

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "source": { "connection": { "id": "{{sourceConnectionId}}" }, "target": { "path": "{{sourcePath}}" } }, "destination": { "connection": { "id": "{{destinationConnectionId}}" }, "target": { "path": "{{destinationPath}}" } } }

Contents of templateOptions.json with sample values

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 { "source": { "connection": { "id": "490d8c2eba054392bde988a548d88354" }, "target": { "path": "/source" } }, "destination": { "connection": { "id": "fbc78a0fa9074d20b778e6e6fc1bd898" }, "target": { "path": "/destination" } } }

Sample expected results

1 2 3 4 ID 8b9ea3d812e24d7892d88d63acb40402 Name Example Tempalte Kind transfer Enabled true

 

Delete a Job Template

This command will delete the specified job template

parameter

description

required

default

parameter

description

required

default

id

The ID of the template 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 templates delete {{id}}

Command with example values

1 skysync-cli templates delete 5dc531df34554edd96c31272262ad950
Expected results
1 The template was deleted successfully.

 

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

Expected results

1 The template could not be deleted.

 

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