...
...
Image Added
...
On This Page
...
Templates
List Templates
parameter | description |
| 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.
Code Block |
---|
|
skysync-cli templates list |
Code Block |
---|
|
ID Name Kind Enabled
382d78ab17784b6bb14844ba1ea819bc Example template 1 transfer true
8c92e69280b74d1aa8c66e6c992ac475 Example template 2 transfer true |
Code Block |
---|
title | example results (JSON) |
---|
|
[
{
"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.
Code Block |
---|
|
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.
Code Block |
---|
|
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.
Code Block |
---|
|
skysync-cli templates list --search test |
Code Block |
---|
|
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.
Code Block |
---|
|
skysync-cli templates list --offset=5 |
Show a Job Template
This command will show the details of the specified job template.
parameter | description |
| 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.
Code Block |
---|
title | command with variables |
---|
|
skysync-cli templates show {{id}} |
Code Block |
---|
title | command with example values |
---|
|
skysync-cli templates show 382d78ab17784b6bb14844ba1ea819bc |
Code Block |
---|
|
ID 382d78ab17784b6bb14844ba1ea819bc
Name Example template 1
Kind transfer
Enabled true |
Code Block |
---|
title | example results (JSON) |
---|
|
[
{
"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.
Code Block |
---|
|
ID
Name
Kind
Enabled true |
Code Block |
---|
title | expected results (JSON) |
---|
|
null |
Create a Job Template
This command will create a template.
parameter | description |
| 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 |
|
|
Panel |
---|
|
If both auto and manual are set to true, the job will be created to run manually. |
Panel |
---|
|
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.
Panel |
---|
|
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. |
Code Block |
---|
title | command with variables (PowerShell) |
---|
|
'{"source": {"connection": {"id": "{{sourceConnectionId"}, "target": {"path": "{{sourcePath}}"}}, "destination": {"connection": {"id": "{{destinationConnectionId"}, "target": {"path": "{{destinationPath}}"}}}' | skysync-cli templates add --manual --in --name="Example Template" |
Code Block |
---|
title | sample expected results |
---|
|
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.
Code Block |
---|
|
skysync-cli templates add --name="Example Template" --manual --options-file=templateOptions.JSON |
Code Block |
---|
title | contents of templateOptions.json with variables |
---|
|
{
"source":
{
"connection":
{
"id": "{{sourceConnectionId}}"
},
"target":
{
"path": "{{sourcePath}}"
}
},
"destination":
{
"connection":
{
"id": "{{destinationConnectionId}}"
},
"target":
{
"path": "{{destinationPath}}"
}
}
} |
Code Block |
---|
title | contents of templateOptions.json with sample values |
---|
|
{
"source":
{
"connection":
{
"id": "490d8c2eba054392bde988a548d88354"
},
"target":
{
"path": "/source"
}
},
"destination":
{
"connection":
{
"id": "fbc78a0fa9074d20b778e6e6fc1bd898"
},
"target":
{
"path": "/destination"
}
}
} |
Code Block |
---|
title | sample expected results |
---|
|
ID 8b9ea3d812e24d7892d88d63acb40402
Name Example Tempalte
Kind transfer
Enabled true |
Delete a Job Template
This command will delete the specified job template
parameter | description |
| 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.
Code Block |
---|
title | command with variables |
---|
|
skysync-cli templates delete {{id}} |
Code Block |
---|
title | command with example values |
---|
|
skysync-cli templates delete 5dc531df34554edd96c31272262ad950 |
Code Block |
---|
|
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.
Code Block |
---|
|
The template could not be deleted. |
Panel |
---|
The response is only available in the default format. If JSON output is specified, no output will be provided. |