# Automation

Automate transfers and fetch information about mounted tapes using Canister's API.

{% hint style="info" %}
A `Pro` license is required to use the Canister API. Mac support is coming soon.
{% endhint %}

## How it works

The Canister API responds to URLs beginning with `canister://`. These can be triggered from a browser, shell, or script. [Deployment calls](https://app.gitbook.com/o/-LStRji1SZuLAktaB8Sd/s/-LStRji2w1AYja1bLBFv/~/edit/~/changes/2214/canister/features/deployment#deployment-call-list) can be included in your automated workflows.

\
**Example script usage**

{% tabs %}
{% tab title="Windows" %}
Using Python:

```
import os
os.system("start canister://open")
```

{% endtab %}
{% endtabs %}

#### Add Archive <a href="#deactivate" id="deactivate"></a>

Archive a source to all mounted tapes:

```
canister://addarchive?sources="E:\Important footage"
```

| URL Parameter | Type   | Required? |
| ------------- | ------ | --------- |
| sources       | String | Mandatory |

A Collection of different sources, files, or folders can be combined using the `|` ("pipe") operator. Source paths must either be wrapped in quotes or URL encoded.

```
canister://addarchive?sources="E:\Important footage 1"|"F:\Important footage 2"
```

Optional parameters for choosing a destination tape and folder are available:

| URL Parameter     | Type   | Required? |
| ----------------- | ------ | --------- |
| destinationtape   | string | optional  |
| destinationfolder | string | optional  |

Putting it together:

{% code overflow="wrap" %}

```
canister://addarchive?sources="E:\Important footage 1"&destinationtape="Archive 01"&destinationfolder="260304"
```

{% endcode %}

#### Add Retrieve <a href="#deactivate" id="deactivate"></a>

Retrieve folders or files from tape:

{% code overflow="wrap" %}

```
canister://addretrieve?sources="260304\Important footage 1"&sourcetape="Archive 01"&destinationpath="E:\Retrieved Footage"
```

{% endcode %}

| URL Parameter   | Type   | Required? |
| --------------- | ------ | --------- |
| sources         | string | mandatory |
| sourcetape      | string | mandatory |
| destinationpath | string | mandatory |

#### Get Tapes <a href="#deactivate" id="deactivate"></a>

Generate a JSON list of mounted tapes using `gettapes`. Set an optional path for the dump using the `path` parameter:

```
canister://gettapes?path="c:\temp scripts"
```

| URL Parameter | Type   | Required? |
| ------------- | ------ | --------- |
| path          | String | optional  |

Sample output:

```
[
  {
    "name"               : "Archive 01",
    "serial"             : "19WT134678",
    "driveLetter"        : "Z",
    "status"             : "READY",
    "totalCapacityBytes" : 2408088338432,
    "freeBytes"          : 2408085192704
  }
]
```
