Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »



On This Page



Templates

List Templates

parameterdescription
default
kindJob Template Kindoptional
search, qSearch textoptional
activeOnly retrieve active job templatesoptional
offsetSearch offsetoptional0
limitSearch page sizeoptional20

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
skysync-cli templates list
example results
ID                               Name                                      Kind     Enabled
382d78ab17784b6bb14844ba1ea819bc Example template 1						   transfer true
8c92e69280b74d1aa8c66e6c992ac475 Example template 2						   transfer true
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.  

command
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
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
skysync-cli templates list --search test
command
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
skysync-cli templates list --offset=5

Show a Job Template

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

parameterdescription
default
idThe ID of the job template for which details will be shownrequired

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
skysync-cli templates show {{id}}
command with example values
skysync-cli templates show 382d78ab17784b6bb14844ba1ea819bc
example results
ID      382d78ab17784b6bb14844ba1ea819bc
Name    Example template 1
Kind    transfer
Enabled true
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.

expected results
ID
Name
Kind
Enabled true
expected results (JSON)
null

Create a Job Template

This command will create a template.

parameterdescription
default
kindThe job template kindrequired

transfer

nameThe job template nameoptional
autoSchedule the job as automaticoptionaltrue
manualSchedule the job as manualoptional

false

options-input, inRead JSON options from stdin

options-file, fileThe 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)
'{"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
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
skysync-cli templates add --name="Example Template" --manual --options-file=templateOptions.JSON
contents of templateOptions.json with variables
{
	"source": 
	{
		"connection": 
		{
			"id": "{{sourceConnectionId}}"
		}, 
		"target": 
		{
			"path": "{{sourcePath}}"
		}
	},
	"destination": 
	{
		"connection": 
		{
			"id": "{{destinationConnectionId}}"
		}, 
		"target": 
		{
			"path": "{{destinationPath}}"
		}
	}
}
contents of templateOptions.json with sample values
{
	"source": 
	{
		"connection": 
		{
			"id": "490d8c2eba054392bde988a548d88354"
		}, 
		"target": 
		{
			"path": "/source"
		}
	},
	"destination": 
	{
		"connection": 
		{
			"id": "fbc78a0fa9074d20b778e6e6fc1bd898"
		}, 
		"target": 
		{
			"path": "/destination"
		}
	}
}


sample expected results
ID      8b9ea3d812e24d7892d88d63acb40402
Name    Example Tempalte
Kind    transfer
Enabled true

Delete a Job Template

This command will delete the specified job template

parameterdescription
default
idThe ID of the template to be deletedrequired

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
skysync-cli templates delete {{id}}
command with example values
skysync-cli templates delete 5dc531df34554edd96c31272262ad950
expected results
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
The template could not be deleted.

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

  • No labels