Skip to main content
ONTAP 9.16.1 REST API reference

Storage snapshot-policies snapshot_policy.uuid schedules endpoint overview

Contributors

Overview

In ONTAP, scheduled snapshot creation works based on the schedules associated with snapshot policies. ONTAP provides six cluster-wide schedules: "5min", "8hour", "hourly", "daily", "weekly" and "monthly". A snapshot policy is created using at least one of these schedules and up to 5 schedules can be associated with a snapshot policy. A snapshot policy can be linked to a storage object and based on the schedule in the policy, snapshots are created on the object at that interval. Each schedule in a snapshot policy has a snapshot name prefix attached to it. Every snapshot created using this policy has this prefix in its name. There is also a retention count associated with every schedule. This count indicates the maximum number of snapshots that can exist for a given schedule. Once the snapshot count reaches the retention count, on the next create operation, the oldest snapshot is deleted. A retention period can be associated with every schedule. During snapshot creation, this period is set as SnapLock expiry time on snapshot locking enabled volumes.

A schedule can be added, modified or deleted from a snapshot policy.

Snapshot policy schedule APIs

The following APIs are used to perform operations related to snapshot policy schedules:

– POST /api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/

– GET /api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/

– GET /api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/{schedule.uuid}

– PATCH /api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/{schedule.uuid}

– DELETE /api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/{schedule.uuid}

Examples

Adding schedule to a snapshot policy

The POST operation is used to create a schedule for a snapshot policy with the specified attributes.

# The API:
/api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/

# The call:
curl -X POST  "https://<mgmt-ip>/api/storage/snapshot-policies/32a0841a-818e-11e9-b4f4-005056bbab9c/schedules" -H "accept: application/hal+json" -d '{"schedule.uuid": "7c985d80-818a-11e9-b4f4-005056bbab9c", "count": "5", "prefix": "new_hourly" }'

# The response:
HTTP/1.1 201 Created
Date: Wed, 29 May 2019 22:41:33 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Location: /api/storage/snapshot-policies/32a0841a-818e-11e9-b4f4-005056bbab9c/schedules
Content-Length: 271
Content-Type: application/json
{
"num_records": 1,
"records": [
  {
    "snapshot_policy": {
      "uuid": "32a0841a-818e-11e9-b4f4-005056bbab9c"
    },
    "schedule": {
      "uuid": "7c985d80-818a-11e9-b4f4-005056bbab9c"
    },
    "count": 5,
    "prefix": "new_monthly"
  }
]
}

Retrieving snapshot policy schedules

The GET operation is used to retrieve snapshot policy schedules.

# The API:
/api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/

# The call:
curl -X GET "https://<mgmt-ip>/api/storage/snapshot-policies/32a0841a-818e-11e9-b4f4-005056bbab9c/schedules" -H "accept: application/hal+json"

# The response:
HTTP/1.1 200 OK
Date: Wed, 29 May 2019 22:49:58 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 898
Content-Type: application/json
{
"records": [
  {
    "snapshot_policy": {
      "uuid": "32a0841a-818e-11e9-b4f4-005056bbab9c"
    },
    "schedule": {
      "uuid": "63d017dc-818a-11e9-b4f4-005056bbab9c",
      "name": "5min"
    }
  },
  {
    "snapshot_policy": {
      "uuid": "32a0841a-818e-11e9-b4f4-005056bbab9c"
    },
    "schedule": {
      "uuid": "64a5c5da-818a-11e9-b4f4-005056bbab9c",
      "name": "8hour"
    }
  },
  {
    "snapshot_policy": {
      "uuid": "32a0841a-818e-11e9-b4f4-005056bbab9c"
    },
    "schedule": {
      "uuid": "63e21a3e-818a-11e9-b4f4-005056bbab9c",
      "name": "daily"
    }
  },
  {
    "snapshot_policy": {
      "uuid": "32a0841a-818e-11e9-b4f4-005056bbab9c"
    },
    "schedule": {
      "uuid": "7c985d80-818a-11e9-b4f4-005056bbab9c",
      "name": "monthly"
    }
  }
],
"num_records": 4
}

Retrieving the attributes of a specific snapshot policy schedule

The GET operation is used to retrieve the attributes of a specific snapshot policy schedule.

# The API:
/api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/{schedule.uuid}

# The call:
curl -X GET "https://<mgmt-ip>/api/storage/snapshot-policies/32a0841a-818e-11e9-b4f4-005056bbab9c/schedules/7c985d80-818a-11e9-b4f4-005056bbab9c" -H "accept: application/hal+json"

# The response:
HTTP/1.1 200 OK
Date: Wed, 29 May 2019 22:54:06 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 238
Content-Type: application/json
{
"snapshot_policy": {
  "uuid": "32a0841a-818e-11e9-b4f4-005056bbab9c"
},
"schedule": {
  "uuid": "7c985d80-818a-11e9-b4f4-005056bbab9c",
  "name": "monthly"
},
"count": 5,
"prefix": "new_monthly",
"snapmirror_label": "-",
"retention_period": "PT20M"
}

Updating a snapshot policy schedule

The PATCH operation is used to update the specific attributes of a snapshot policy.

# The API:
/api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/{schedule.uuid}

# The call:
curl -X PATCH  "https://<mgmt-ip>/api/storage/snapshot-policies/32a0841a-818e-11e9-b4f4-005056bbab9c/schedules/7c985d80-818a-11e9-b4f4-005056bbab9c" -d '{"count": "10" }' -H "accept: application/hal+json"

# The response:
HTTP/1.1 200 OK
Date: Wed, 29 May 2019 23:08:00 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 3
Content-Type: application/json

Deleting a snapshot policy

The DELETE operation is used to delete a snapshot policy.

# The API:
/api/storage/snapshot-policies/{snapshot_policy.uuid}/schedules/{schedule.uuid}

# The call:
curl -X DELETE "https://<mgmt-ip>/api/storage/snapshot-policies/32a0841a-818e-11e9-b4f4-005056bbab9c/schedules/7c985d80-818a-11e9-b4f4-005056bbab9c" -H "accept: application/hal+json"

# The response:
HTTP/1.1 200 OK
Date: Wed, 29 May 2019 23:12:32 GMT
Server: libzapid-httpd
X-Content-Type-Options: nosniff
Cache-Control: no-cache,no-store,must-revalidate
Content-Length: 3
Content-Type: application/json