Storage volumes volume.uuid snapshots endpoint overview
Overview
A snapshot is the view of the filesystem as it exists at the time when the snapshot is created.
In ONTAP, different types of snapshots are supported, such as scheduled snapshots, user requested snapshots, SnapMirror snapshots, and so on.
ONTAP snapshot APIs allow you to create, modify, delete and retrieve snapshots.
ONTAP Bulk snapshot APIs allow you to create, modify, delete and retrieve snapshots on multiple volumes in one request.
Snapshot APIs
The following APIs are used to perform operations related to snapshots.
– 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} The following APIs are used to perform bulk operations related to snapshots.
– POST /api/storage/volumes/*/snapshots
– GET /api/storage/volumes/*/snapshots
– PATCH /api/storage/volumes/*/snapshots/{uuid}
– DELETE /api/storage/volumes/*/snapshots/{uuid}
Examples
Creating a snapshot
The POST operation is used to create a snapshot 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 attributes
The GET operation is used to retrieve snapshot 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" } } }
Creating bulk snapshots
The POST operation is used to create a snapshot with the same name on multiple volumes in one request. This operation accepts a volume UUID or volume name and SVM, and a snapshot name. This operation only supports SnapMirror label attributes to be added to snapshots during creation.
# The API: /api/storage/volumes/*/snapshots # The call: curl -k -u admin -X POST "https://<mgmt-ip>/api/storage/volumes/*/snapshots" -H 'accept: application/hal+json' -d '{"records": [{"volume.uuid":"e8815adb-5209-11ec-b4ad-005056bbc3e8", "name":"snapshot_copy"},{ "volume.uuid":"efda9101-5209-11ec-b4ad-005056bbc3e8", "name":"snapshot_copy"}]}' # The response: HTTP/1.1 202 Accepted Date: Tue, 14 Dec 2021 20:18:13 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors: 'self' Location: /api/storage/volumes/*/snapshots/ Content-Length: 209 Content-Type: application/json { "num_records": 2, "job": { "uuid": "f7130fc0-5d1a-11ec-b78c-005056bbb467", "_links": { "self": { "href": "/api/cluster/jobs/f7130fc0-5d1a-11ec-b78c-005056bbb467" } } } } # The Job: HTTP/1.1 200 OK Date: Tue, 14 Dec 2021 20:20:54 GMT Server: libzapid-httpd X-Content-Type-Options: nosniff Cache-Control: no-cache,no-store,must-revalidate Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors: 'self' Content-Length: 258 Content-Type: application/json Vary: Accept-Encoding { "uuid": "f7130fc0-5d1a-11ec-b78c-005056bbb467", "description": "POST /api/storage/volumes/*/snapshots/", "state": "success", "message": "success", "code": 0, "start_time": "2021-12-14T15:18:13-05:00", "end_time": "2021-12-14T15:18:13-05:00" }
Retrieving snapshot advanced attributes
A collection GET request is used to calculate the amount of snapshot reclaimable space. When the advanced privilege field 'reclaimable space' is requested, the API returns the amount of reclaimable space for the queried list of snapshots.
# 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 snapshot advanced attributes
A collection GET request is used to calculate the delta between two snapshots. When the advanced privilege field 'delta' is requested, the API returns the delta between the queried snapshots.
# The API: /api/storage/volumes/{volume.uuid}/snapshots?fields=delta # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/{volume.uuid}/snapshots?fields=delta&name=hourly.2022-06-29_1105,hourly.2022-06-29_1205" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK Connection: Keep-Alive Content-Encoding: gzip Content-Length: 378 Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors: 'self' Content-Type: application/hal+json Date: Wed, 29 Jun 2022 18:37:11 GMT Keep-Alive: timeout=5, max=99 Server: libzapid-httpd Vary: Accept-Encoding X-Content-Type-Options: nosniff { "records": [ { "uuid": "52a2247a-7735-4a92-bc3c-e51df1fe502f", "name": "hourly.2022-06-29_1105", "delta": { "size_consumed": 675840, "time_elapsed": "PT3H27M45S" } }, { "uuid": "b399eb34-44fe-4689-9fb5-c8f72162dd77", "name": "hourly.2022-06-29_1205", "delta": { "size_consumed": 507904, "time_elapsed": "PT2H27M45S" } } ], "num_records": 2, "delta": { "size_consumed": 167936, "time_elapsed": "PT1H" } }
Retrieving the attributes of a specific snapshot
The GET operation is used to retrieve the attributes of a specific snapshot.
# 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
The GET operation is used to retrieve the attributes of a specific snapshot. Snapshot 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.
# 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" } } }
Retrieving snapshot advanced attributes
A collection GET request is used to calculate the delta between two snapshots. When the advanced privilege field 'delta' is requested, the API returns the delta between the queried snapshots.
# The API: /api/storage/volumes/{volume.uuid}/snapshots?fields=delta # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/{volume.uuid}/snapshots?fields=delta&name=hourly.2022-06-29_1105,hourly.2022-06-29_1205" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK Connection: Keep-Alive Content-Encoding: gzip Content-Length: 378 Content-Security-Policy: default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; frame-ancestors: 'self' Content-Type: application/hal+json Date: Wed, 29 Jun 2022 18:37:11 GMT Keep-Alive: timeout=5, max=99 Server: libzapid-httpd Vary: Accept-Encoding X-Content-Type-Options: nosniff { "records": [ { "uuid": "52a2247a-7735-4a92-bc3c-e51df1fe502f", "name": "hourly.2022-06-29_1105", "delta": { "size_consumed": 675840, "time_elapsed": "PT3H27M45S" } }, { "uuid": "b399eb34-44fe-4689-9fb5-c8f72162dd77", "name": "hourly.2022-06-29_1205", "delta": { "size_consumed": 507904, "time_elapsed": "PT2H27M45S" } } ], "num_records": 2, "delta": { "size_consumed": 167936, "time_elapsed": "PT1H" } }
Retrieving bulk snapshots
The bulk GET operation is used to retrieve snapshot attributes across all volumes.
# The API: /api/storage/volumes/*/snapshots # The call: curl -X GET "https://<mgmt-ip>/api/storage/volumes/*/snapshots" -H "accept: application/hal+json" # The response: HTTP/1.1 200 OK { "records": [ { "volume": { "uuid": "966c285f-47f7-11ec-8407-005056bbc08f", "name": "v1" }, "uuid": "3edba912-5507-4535-adce-e12fe5c0e31c", "name": "daily.2021-11-18_0010" }, { "volume": { "uuid": "966c285f-47f7-11ec-8407-005056bbc08f", "name": "v1" }, "uuid": "3ad61153-d5ef-495d-8e0e-5c3b8bbaf5e6", "name": "hourly.2021-11-18_0705" }, { "volume": { "uuid": "99c974e3-47f7-11ec-8407-005056bbc08f", "name": "v2" }, "uuid": "3dd0fa97-65d9-41ea-a99d-5ceb9d2f55c5", "name": "daily.2021-11-18_0010" }, { "volume": { "uuid": "99c974e3-47f7-11ec-8407-005056bbc08f", "name": "v2" }, "uuid": "6ca20a52-c342-4753-8865-3693fa9b7e23", "name": "hourly.2021-11-18_0705" }, ], "num_records": 4 }
Updating a snapshot
The PATCH operation is used to update the specific attributes of a snapshot.
# 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 }
Updating bulk snapshots
The bulk PATCH operation is used to update the specific attributes of snapshots across volumes in a single request.
# The API: /api/storage/volumes/*/snapshots # The call: curl -X PATCH "https://<mgmt-ip>/api/storage/volumes/*/snapshots" -d '{"records": [{"volume.uuid":"e8815adb-5209-11ec-b4ad-005056bbc3e8", "svm.uuid":"d0e6def5-5209-11ec-b4ad-005056bbc3e8", "uuid":"f9b7714d-1166-410a-b143-874f27969db6", "comment":"yay"},{"volume.uuid":"efda9101-5209-11ec-b4ad-005056bbc3e8", "svm.uuid":"d0e6def5-5209-11ec-b4ad-005056bbc3e8", "uuid":"514c82a7-bff7-48e2-a13c-5337b09ed41e", "comment":"yay"}]}' -H "accept: application/hal+json" # The response: HTTP/1.1 202 Accepted { "job": { "uuid": "1e9a561f-520f-11ec-b4ad-005056bbc3e8", "_links": { "self": { "href": "/api/cluster/jobs/1e9a561f-520f-11ec-b4ad-005056bbc3e8" }, "results": { "href": "/api/storage/volumes/*/snapshots?job_results_uuid=1e9a561f-520f-11ec-b4ad-005056bbc3e8" } } } } # The Job: curl -u admin:<password> -k -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' 'https://<mgmt-ip>/api/storage/volumes/*/snapshots?job_results_uuid=1e9a561f-520f-11ec-b4ad-005056bbc3e8' HTTP/1.1 200 OK { "records": [ { "volume": { "uuid": "e8815adb-5209-11ec-b4ad-005056bbc3e8", "name": "v1" }, "uuid": "f9b7714d-1166-410a-b143-874f27969db6", "svm": { "uuid": "d0e6def5-5209-11ec-b4ad-005056bbc3e8" }, "name": "s1", "comment": "yay" }, { "volume": { "uuid": "efda9101-5209-11ec-b4ad-005056bbc3e8", "name": "v2" }, "uuid": "514c82a7-bff7-48e2-a13c-5337b09ed41e", "svm": { "uuid": "d0e6def5-5209-11ec-b4ad-005056bbc3e8" }, "name": "s1", "comment": "yay" } ], "num_records": 2 }
Deleting a snapshot
The DELETE operation is used to delete a snapshot.
# 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 }
Deleting bulk snapshots
The bulk DELETE operation is used to delete a snapshots across volumes in a single request.
# The API: /api/storage/volumes/*/snapshots # The call: curl -X DELETE "https://<mgmt-ip>/api/storage/volumes/*/snapshots" -d '{"records": [{"volume.uuid":"e8815adb-5209-11ec-b4ad-005056bbc3e8", "uuid":"f9b7714d-1166-410a-b143-874f27969db6"}, {"volume.uuid":"efda9101-5209-11ec-b4ad-005056bbc3e8", "uuid":"1d55c97a-25f3-4366-bfa8-9ea75c255469"}]}' -H "accept: application/hal+json" # The response: HTTP/1.1 202 Accepted { "job": { "uuid": "fe114ed7-520f-11ec-b4ad-005056bbc3e8", "_links": { "self": { "href": "/api/cluster/jobs/fe114ed7-520f-11ec-b4ad-005056bbc3e8" }, "results": { "href": "/api/storage/volumes/*/snapshots?job_results_uuid=fe114ed7-520f-11ec-b4ad-005056bbc3e8" } } } } # The Job: HTTP/1.1 200 OK curl -u admin:<password> -k -X GET --header 'Content-Type: application/json' --header 'Accept: application/json' 'https://<mgmt-ip>/api/storage/volumes/*/snapshots?job_results_uuid=fe114ed7-520f-11ec-b4ad-005056bbc3e8' { "records": [ ], "num_records": 0 }