# Snapshots

## List Snapshots

<mark style="color:blue;">`GET`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/snapshots`

Lists all Snapshots.

#### Path Parameters

| Name         | Type   | Description                                           |
| ------------ | ------ | ----------------------------------------------------- |
| tvm\_address | string | IP or FQDN of Trilio service                          |
| tenant\_id   | string | ID of the Tenant/Projects to fetch the Snapshots from |

#### Query Parameters

| Name         | Type    | Description                                                                             |
| ------------ | ------- | --------------------------------------------------------------------------------------- |
| host         | string  | host name of the TVM that took the Snapshot                                             |
| workload\_id | string  | ID of the Workload to list the Snapshots off                                            |
| date\_from   | string  | <p>starting date of Snapshots to show</p><p>\</p></p><p>Format: YYYY-MM-DDTHH:MM:SS</p> |
|              | string  | <p>ending date of Snapshots to show</p><p>\</p></p><p>Format: YYYY-MM-DDTHH:MM:SS</p>   |
| all          | boolean | admin role required - True lists all Snapshots of all Workloads                         |

#### Headers

| Name              | Type   | Description                               |
| ----------------- | ------ | ----------------------------------------- |
| X-Auth-Project-Id | string | project to run the authentication against |
| X-Auth-Token      | string | Authentication token to use               |
| Accept            | string | application/json                          |
| User-Agent        | string | python-workloadmgrclient                  |

{% tabs %}
{% tab title="200 Return of a single Snapshot" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Wed, 04 Nov 2020 12:58:38 GMT
Content-Type: application/json
Content-Length: 266
Connection: keep-alive
X-Compute-Request-Id: req-ed391cf9-aa56-4c53-8153-fd7fb238c4b9

{
   "snapshots":[
      {
         "id":"1ff16412-a0cd-4e6a-9b4a-b5d4440fffc4",
         "created_at":"2020-11-02T14:03:18.000000",
         "status":"available",
         "snapshot_type":"full",
         "workload_id":"18b809de-d7c8-41e2-867d-4a306407fb11",
         "name":"snapshot",
         "description":"-",
         "host":"TVM1"
      }
   ]
}
```

{% endtab %}
{% endtabs %}

## Take Snapshot

<mark style="color:green;">`POST`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/workloads/<workload_id>`

#### Path Parameters

| Name         | Type   | Description                                      |
| ------------ | ------ | ------------------------------------------------ |
| tvm\_address | string | IP or FQDN of the Trilio Service                 |
| tenant\_id   | string | ID of the Tenant/Project to take the Snapshot in |
| workload\_id | string | ID of the Workload to take the Snapshot in       |

#### Query Parameters

| Name | Type    | Description                  |
| ---- | ------- | ---------------------------- |
| full | boolean | True creates a full Snapshot |

#### Headers

| Name              | Type   | Description                           |
| ----------------- | ------ | ------------------------------------- |
| X-Auth-Project-Id | string | Project to run authentication against |
| X-Auth-Token      | string | Authentication token to use           |
| Content-Type      | string | application/json                      |
| Accept            | string | application/json                      |
| User-Agent        | string | python-workloadmgrclient              |

{% tabs %}
{% tab title="200 " %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Wed, 04 Nov 2020 13:58:38 GMT
Content-Type: application/json
Content-Length: 283
Connection: keep-alive
X-Compute-Request-Id: req-fb8dc382-e5de-4665-8d88-c75b2e473f5c

{
   "snapshot":{
      "id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
      "created_at":"2020-11-04T13:58:37.694637",
      "status":"creating",
      "snapshot_type":"full",
      "workload_id":"18b809de-d7c8-41e2-867d-4a306407fb11",
      "name":"API taken 2",
      "description":"API taken description 2",
      "host":""
   }
}
```

{% endtab %}
{% endtabs %}

### Body format

When creating a Snapshot it is possible to provide additional information

{% hint style="info" %}
This Body is completely optional
{% endhint %}

```
{
   "snapshot":{
      "is_scheduled":<true/false>,
      "name":"<name>",
      "description":"<description>"
   }
}
```

## Show Snapshot

<mark style="color:blue;">`GET`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/snapshots/<snapshot_id>`

Shows the details of a specified Snapshot

#### Path Parameters

| Name         | Type   | Description                                        |
| ------------ | ------ | -------------------------------------------------- |
| tvm\_address | string | IP or FQDN of the Trilio Service                   |
| tenant\_id   | string | ID of the Tenant/Project to take the Snapshot from |
| snapshot\_id | string | ID of the Snapshot to show                         |

#### Headers

| Name              | Type   | Description                           |
| ----------------- | ------ | ------------------------------------- |
| X-Auth-Project-Id | string | Project to run authentication against |
| X-Auth-Token      | string | Authentication token to use           |
| Accept            | string | application/json                      |
| User-Agent        | string | python-workloadmgrclient              |

{% tabs %}
{% tab title="200 Returns all details about a Snapshot" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Wed, 04 Nov 2020 14:07:18 GMT
Content-Type: application/json
Content-Length: 6609
Connection: keep-alive
X-Compute-Request-Id: req-f88fb28f-f4ce-4585-9c3c-ebe08a3f60cd

{
   "snapshot":{
      "id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
      "created_at":"2020-11-04T13:58:37.000000",
      "updated_at":"2020-11-04T14:06:03.000000",
      "finished_at":"2020-11-04T14:06:03.000000",
      "user_id":"ccddc7e7a015487fa02920f4d4979779",
      "project_id":"c76b3355a164498aa95ddbc960adc238",
      "status":"available",
      "snapshot_type":"full",
      "workload_id":"18b809de-d7c8-41e2-867d-4a306407fb11",
      "instances":[
         {
            "id":"67d6a100-fee6-4aa5-83a1-66b070d2eabe",
            "name":"cirros-2",
            "status":"available",
            "metadata":{
               "availability_zone":"nova",
               "config_drive":"",
               "data_transfer_time":"0",
               "object_store_transfer_time":"0",
               "root_partition_type":"Linux",
               "trilio_ordered_interfaces":"192.168.100.80",
               "vm_metadata":"{\"workload_name\": \"Workload_1\", \"workload_id\": \"18b809de-d7c8-41e2-867d-4a306407fb11\", \"trilio_ordered_interfaces\": \"192.168.100.80\", \"config_drive\": \"\"}",
               "workload_id":"18b809de-d7c8-41e2-867d-4a306407fb11",
               "workload_name":"Workload_1"
            },
            "flavor":{
               "vcpus":"1",
               "ram":"512",
               "disk":"1",
               "ephemeral":"0"
            },
            "security_group":[
               {
                  "name":"default",
                  "security_group_type":"neutron"
               }
            ],
            "nics":[
               {
                  "mac_address":"fa:16:3e:cf:10:91",
                  "ip_address":"192.168.100.80",
                  "network":{
                     "id":"5fb7027d-a2ac-4a21-9ee1-438c281d2b26",
                     "name":"robert_internal",
                     "cidr":null,
                     "network_type":"neutron",
                     "subnet":{
                        "id":"b7b54304-aa82-4d50-91e6-66445ab56db4",
                        "name":"robert_internal",
                        "cidr":"192.168.100.0/24",
                        "ip_version":4,
                        "gateway_ip":"192.168.100.1"
                     }
                  }
               }
            ],
            "vdisks":[
               {
                  "label":null,
                  "resource_id":"fa888089-5715-4228-9e5a-699f8f9d59ba",
                  "restore_size":1073741824,
                  "vm_id":"67d6a100-fee6-4aa5-83a1-66b070d2eabe",
                  "volume_id":"51491d30-9818-4332-b056-1f174e65d3e3",
                  "volume_name":"51491d30-9818-4332-b056-1f174e65d3e3",
                  "volume_size":"1",
                  "volume_type":"iscsi",
                  "volume_mountpoint":"/dev/vda",
                  "availability_zone":"nova",
                  "metadata":{
                     "readonly":"False",
                     "attached_mode":"rw"
                  }
               }
            ]
         },
         {
            "id":"e33c1eea-c533-4945-864d-0da1fc002070",
            "name":"cirros-1",
            "status":"available",
            "metadata":{
               "availability_zone":"nova",
               "config_drive":"",
               "data_transfer_time":"0",
               "object_store_transfer_time":"0",
               "root_partition_type":"Linux",
               "trilio_ordered_interfaces":"192.168.100.176",
               "vm_metadata":"{\"workload_name\": \"Workload_1\", \"workload_id\": \"18b809de-d7c8-41e2-867d-4a306407fb11\", \"trilio_ordered_interfaces\": \"192.168.100.176\", \"config_drive\": \"\"}",
               "workload_id":"18b809de-d7c8-41e2-867d-4a306407fb11",
               "workload_name":"Workload_1"
            },
            "flavor":{
               "vcpus":"1",
               "ram":"512",
               "disk":"1",
               "ephemeral":"0"
            },
            "security_group":[
               {
                  "name":"default",
                  "security_group_type":"neutron"
               }
            ],
            "nics":[
               {
                  "mac_address":"fa:16:3e:cf:4d:27",
                  "ip_address":"192.168.100.176",
                  "network":{
                     "id":"5fb7027d-a2ac-4a21-9ee1-438c281d2b26",
                     "name":"robert_internal",
                     "cidr":null,
                     "network_type":"neutron",
                     "subnet":{
                        "id":"b7b54304-aa82-4d50-91e6-66445ab56db4",
                        "name":"robert_internal",
                        "cidr":"192.168.100.0/24",
                        "ip_version":4,
                        "gateway_ip":"192.168.100.1"
                     }
                  }
               }
            ],
            "vdisks":[
               {
                  "label":null,
                  "resource_id":"c8293bb0-031a-4d33-92ee-188380211483",
                  "restore_size":1073741824,
                  "vm_id":"e33c1eea-c533-4945-864d-0da1fc002070",
                  "volume_id":"365ad75b-ca76-46cb-8eea-435535fd2e22",
                  "volume_name":"365ad75b-ca76-46cb-8eea-435535fd2e22",
                  "volume_size":"1",
                  "volume_type":"iscsi",
                  "volume_mountpoint":"/dev/vda",
                  "availability_zone":"nova",
                  "metadata":{
                     "readonly":"False",
                     "attached_mode":"rw"
                  }
               }
            ]
         }
      ],
      "name":"API taken 2",
      "description":"API taken description 2",
      "host":"TVM1",
      "size":44171264,
      "restore_size":2147483648,
      "uploaded_size":44171264,
      "progress_percent":100,
      "progress_msg":"Snapshot of workload is complete",
      "warning_msg":null,
      "error_msg":null,
      "time_taken":428,
      "pinned":false,
      "metadata":[
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"16fc1ce5-81b2-4c07-ac63-6c9232e0418f",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"backup_media_target",
            "value":"10.10.2.20:/upstream"
         },
         {
            "created_at":"2020-11-04T13:58:37.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"5a56bbad-9957-4fb3-9bbc-469ec571b549",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"cancel_requested",
            "value":"0"
         },
         {
            "created_at":"2020-11-04T14:05:29.000000",
            "updated_at":"2020-11-04T14:05:45.000000",
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"d36abef7-9663-4d88-8f2e-ef914f068fb4",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"data_transfer_time",
            "value":"0"
         },
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"c75f9151-ef87-4a74-acf1-42bd2588ee64",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"hostnames",
            "value":"[\"cirros-1\", \"cirros-2\"]"
         },
         {
            "created_at":"2020-11-04T14:05:29.000000",
            "updated_at":"2020-11-04T14:05:45.000000",
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"02916cce-79a2-4ad9-a7f6-9d9f59aa8424",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"object_store_transfer_time",
            "value":"0"
         },
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"96efad2f-a24f-4cde-8e21-9cd78f78381b",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"pause_at_snapshot",
            "value":"0"
         },
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"572a0b21-a415-498f-b7fa-6144d850ef56",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"policy_id",
            "value":"b79aa5f3-405b-4da4-96e2-893abf7cb5fd"
         },
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"dfd7314d-8443-4a95-8e2a-7aad35ef97ea",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"preferredgroup",
            "value":"[]"
         },
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"2e17e1e4-4bb1-48a9-8f11-c4cd2cfca2a9",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"topology",
            "value":"\"\\\"\\\"\""
         },
         {
            "created_at":"2020-11-04T14:05:57.000000",
            "updated_at":null,
            "deleted_at":null,
            "deleted":false,
            "version":"4.0.115",
            "id":"33762790-8743-4e20-9f50-3505a00dbe76",
            "snapshot_id":"2e56d167-bad7-43c7-8ede-a613c3fe7844",
            "key":"workload_approx_backup_size",
            "value":"6"
         }
      ],
      "restores_info":""
   }
}
```

{% endtab %}
{% endtabs %}

## Delete Snapshot

<mark style="color:red;">`DELETE`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/snapshots/<snapshot_id>`

Deletes a specified Snapshot

#### Path Parameters

| Name         | Type   | Description                                      |
| ------------ | ------ | ------------------------------------------------ |
| tvm\_address | string | IP or FQDN of Trilio service                     |
| tenant\_id   | string | ID of the Tenant/Project to find the Snapshot in |
| snapshot\_id | string | ID of the Snapshot to delete                     |

#### Headers

| Name              | Type   | Description                           |
| ----------------- | ------ | ------------------------------------- |
| X-Auth-Project-Id | string | Project to run authentication against |
| X-Auth-Token      | string | Authentication token to use           |
| Accept            | string | application/json                      |
| User-Agent        | string | python-workloadmgrclient              |

{% tabs %}
{% tab title="200 Delete process started" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Wed, 04 Nov 2020 14:18:36 GMT
Content-Type: application/json
Content-Length: 56
Connection: keep-alive
X-Compute-Request-Id: req-82ffb2b6-b28e-4c73-89a4-310890960dbc

{"task": {"id": "a73de236-6379-424a-abc7-33d553e050b7"}}

```

{% endtab %}
{% endtabs %}

## Cancel Snapshot

<mark style="color:blue;">`GET`</mark> `https://$(tvm_address):8780/v1/$(tenant_id)/snapshots/<snapshot_id>/cancel`

Cancels the Snapshot process of a given Snapshot

#### Path Parameters

| Name         | Type   | Description                                      |
| ------------ | ------ | ------------------------------------------------ |
| tvm\_address | string | IP or FQDN of Trilio service                     |
| tenant\_id   | string | ID of the Tenant/Project to find the Snapshot in |
| snapshot\_id | string | ID of the Snapshot to cancel                     |

#### Headers

| Name              | Type   | Description                           |
| ----------------- | ------ | ------------------------------------- |
| X-Auth-Project-Id | string | Project to run authentication against |
| X-Auth-Token      | string | Authentication token to use           |
| Accept            | string | application/json                      |
| User-Agent        | string | python-workloadmgrclient              |

{% tabs %}
{% tab title="200 Snapshot gets cancelled" %}

```
HTTP/1.1 200 OK
Server: nginx/1.16.1
Date: Wed, 04 Nov 2020 14:26:44 GMT
Content-Type: application/json
Content-Length: 0
Connection: keep-alive
X-Compute-Request-Id: req-47a5a426-c241-429e-9d69-d40aed0dd68d
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.trilio.io/openstack/api-guide/snapshots.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
