Storage volumes volume.uuid snapshots endpoint overview
Overview
A Snapshot copy is the view of the filesystem as it exists at the time when the Snapshot copy is created.
In ONTAP, different types of Snapshot copies are supported, such as scheduled Snapshot copies, user requested Snapshot copies, SnapMirror Snapshot copies, and so on.
ONTAP Snapshot copy APIs allow you to create, modify, delete and retrieve Snapshot copies.
Snapshot copy APIs
The following APIs are used to perform operations related to Snapshot copies.
– POST /api/storage/volumes/{volume.uuid}/snapshots
– GET /api/storage/volumes/{volume.uuid}/snapshots
– GET /api/storage/volumes/{volume.uuid}/snapshots/{uuid}
– PATCH /api/storage/volumes/{volume.uuid}/snapshots/{uuid}
– DELETE /api/storage/volumes/{volume.uuid}/snapshots/{uuid}
Examples
Creating a Snapshot copy
The POST operation is used to create a Snapshot copy with the specified attributes.
# The API: /api/storage/volumes/{volume.uuid}/snapshots # The call: curl -X POST "https://<mgmt-ip>/api/storage/volumes/{volume.uuid}/snapshots" -H "accept: application/hal+json" -d '{"name": "snapshot_copy", "comment": "Store this copy." }' # The response: HTTP/1.1 202 Accepted Date: Wed, 13 Mar 2019 22:43:34 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Location: /api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/?name=snapshot_copy Content-Length: 189 Content-Type: application/json { "num_records": 1, "records": [ { "volume": { "name": "v2" }, "svm": { "uuid": "8139f958-3c6e-11e9-a45f-005056bbc848", "name": "vs0" }, "name": "snapshot_copy", "comment": "Store this copy." } ], "job": { "uuid": "6f68c85b-45e1-11e9-8fc7-005056bbc848", "_links": { "self": { "href": "/api/cluster/jobs/6f68c85b-45e1-11e9-8fc7-005056bbc848" } } } } # The Job: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 22:43:57 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 224 Content-Type: application/json { "uuid": "6f68c85b-45e1-11e9-8fc7-005056bbc848", "description": "POST /api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/?name=snapshot_copy", "state": "success", "message": "success", "code": 0 }
Retrieving Snapshot copy attributes
The GET operation is used to retrieve Snapshot copy attributes.
# The API: /api/storage/volumes/{volume.uuid}/snapshots # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/{volume.uuid}/snapshots" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 21:14:06 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Type: application/json Transfer-Encoding: chunked { "records": [ { "uuid": "402b6c73-73a0-4e89-a58a-75ee0ab3e8c0", "name": "hourly.2019-03-13_1305", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/402b6c73-73a0-4e89-a58a-75ee0ab3e8c0" } } }, { "uuid": "f0dd497f-efe8-44b7-a4f4-bdd3890bc0c8", "name": "hourly.2019-03-13_1405", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/f0dd497f-efe8-44b7-a4f4-bdd3890bc0c8" } } }, { "uuid": "02701900-51bd-46b8-9c77-47d9a9e2ce1d", "name": "hourly.2019-03-13_1522", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/02701900-51bd-46b8-9c77-47d9a9e2ce1d" } } } ], "num_records": 3, "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots" } } }
Retrieving Snapshot copy advanced attributes
A collection GET request is used to calculate the amount of Snapshot copy reclaimable space. When the advanced privilege field 'reclaimable space' is requested, the API returns the amount of reclaimable space for the queried list of Snapshot copies.
# The API: /api/storage/volumes/{volume.uuid}/snapshots?fields=reclaimable_space # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/{volume.uuid}/snapshots?fields=reclaimable_space&name=hourly.2019-03-13_1305|hourly.2019-03-13_1405|hourly.2019-03-13_1522" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 21:14:06 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Type: application/json Transfer-Encoding: chunked { "records": [ { "uuid": "402b6c73-73a0-4e89-a58a-75ee0ab3e8c0", "name": "hourly.2019-03-13_1305", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/402b6c73-73a0-4e89-a58a-75ee0ab3e8c0" } } }, { "uuid": "f0dd497f-efe8-44b7-a4f4-bdd3890bc0c8", "name": "hourly.2019-03-13_1405", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/f0dd497f-efe8-44b7-a4f4-bdd3890bc0c8" } } }, { "uuid": "02701900-51bd-46b8-9c77-47d9a9e2ce1d", "name": "hourly.2019-03-13_1522", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/02701900-51bd-46b8-9c77-47d9a9e2ce1d" } } } ], "num_records": 3, "reclaimable_space": 1567832, "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots" } } }
Retrieving the attributes of a specific Snapshot copy
The GET operation is used to retrieve the attributes of a specific Snapshot copy.
# The API: /api/storage/volumes/{volume.uuid}/snapshots/{uuid} # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/402b6c73-73a0-4e89-a58a-75ee0ab3e8c0" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 22:39:26 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 308 Content-Type: application/json { "volume": { "uuid": "0353dc05-405f-11e9-acb6-005056bbc848", "name": "v2", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848" } } }, "uuid": "402b6c73-73a0-4e89-a58a-75ee0ab3e8c0", "svm": { "uuid": "8139f958-3c6e-11e9-a45f-005056bbc848", "name": "vs0", "_links": { "self": { "href": "/api/svm/svms/8139f958-3c6e-11e9-a45f-005056bbc848" } } }, "name": "hourly.2019-03-13_1305", "create_time": "2019-03-13T13:05:00-04:00", "size": 122880, "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/402b6c73-73a0-4e89-a58a-75ee0ab3e8c0" } } }
Retrieving the advanced attributes of a specific Snapshot copy
The GET operation is used to retrieve the attributes of a specific Snapshot copy. Snapshot copy reclaimable space can be requested during a GET request. When the advanced privilege field reclaimable space is requested, the API returns the amount of reclaimable space for the Snapshot copy.
# The API: /api/storage/volumes/{volume.uuid}/snapshots/{uuid}?fields=reclaimable_space # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/402b6c73-73a0-4e89-a58a-75ee0ab3e8c0?fields=**" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 22:39:26 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 308 Content-Type: application/json { "volume": { "uuid": "0353dc05-405f-11e9-acb6-005056bbc848", "name": "v2", "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848" } } }, "uuid": "402b6c73-73a0-4e89-a58a-75ee0ab3e8c0", "svm": { "uuid": "8139f958-3c6e-11e9-a45f-005056bbc848", "name": "vs0", "_links": { "self": { "href": "/api/svm/svms/8139f958-3c6e-11e9-a45f-005056bbc848" } } }, "name": "hourly.2019-03-13_1305", "reclaimable_space": 167832, "_links": { "self": { "href": "/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/402b6c73-73a0-4e89-a58a-75ee0ab3e8c0" } } }
Updating a Snapshot copy
The PATCH operation is used to update the specific attributes of a Snapshot copy.
# The API: /api/storage/volumes/{volume.uuid}/snapshots/{uuid} # The call: curl -X PATCH "https://<mgmt-ip>/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/16f7008c-18fd-4a7d-8485-a0e290d9db7f" -d '{"name": "snapshot_copy_new" }' -H "accept: application/hal+json" # The response: HTTP/1.1 202 Accepted Date: Wed, 13 Mar 2019 22:50:44 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 189 Content-Type: application/json { "job": { "uuid": "6f7c3a82-45e2-11e9-8fc7-005056bbc848", "_links": { "self": { "href": "/api/cluster/jobs/6f7c3a82-45e2-11e9-8fc7-005056bbc848" } } } } # The Job: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 22:54:16 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 242 Content-Type: application/json { "uuid": "6f7c3a82-45e2-11e9-8fc7-005056bbc848", "description": "PATCH /api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/16f7008c-18fd-4a7d-8485-a0e290d9db7f", "state": "success", "message": "success", "code": 0 }
Deleting a Snapshot copy
The DELETE operation is used to delete a Snapshot copy.
# The API: /api/storage/volumes/{volume.uuid}/snapshots/{uuid} # The call: curl -X DELETE "https://<mgmt-ip>/api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/16f7008c-18fd-4a7d-8485-a0e290d9db7f" -H "accept: application/hal+json" # The response: HTTP/1.1 202 Accepted Date: Wed, 13 Mar 2019 22:57:51 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 189 Content-Type: application/json { "job": { "uuid": "6da1dfdd-45e3-11e9-8fc7-005056bbc848", "_links": { "self": { "href": "/api/cluster/jobs/6da1dfdd-45e3-11e9-8fc7-005056bbc848" } } } } # The Job: HTTP/1.1 200 OK Date: Wed, 13 Mar 2019 23:02:46 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Length: 243 Content-Type: application/json { "uuid": "6da1dfdd-45e3-11e9-8fc7-005056bbc848", "description": "DELETE /api/storage/volumes/0353dc05-405f-11e9-acb6-005056bbc848/snapshots/16f7008c-18fd-4a7d-8485-a0e290d9db7f", "state": "success", "message": "success", "code": 0 }