ONTAP Rest API Discussions

List all Snapshots

ST123
2,158 Views

Hi,

 

I want to list all snapshots from a storage cluster per api call, but I get a different output on CLI vs API. API output is only from one SVM?!

 

API-Request: https://<cluster_mgmt_ip>/api/storage/volumes/*/snapshots

CLI: Cluster::> snapshot show

 

Best Regards

ST

 

1 ACCEPTED SOLUTION

JohnChampion
1,946 Views

Confirmed - interesting the REST API even accepts a wildcard for the volume.uuid - I would expect it would throw an invalid URL error.

 

You can use the Private CLI method and get back results in standard JSON result/records format. The field names are the same as in the CLI - and you cannot use a wildcard (fields=*) with the private CLI method.

 

https://{clustermgtip}/api/private/cli/snapshot?fields=vserver,volume,snapshot,create-time,size,snapmirror-label

 

View solution in original post

3 REPLIES 3

JohnChampion
1,947 Views

Confirmed - interesting the REST API even accepts a wildcard for the volume.uuid - I would expect it would throw an invalid URL error.

 

You can use the Private CLI method and get back results in standard JSON result/records format. The field names are the same as in the CLI - and you cannot use a wildcard (fields=*) with the private CLI method.

 

https://{clustermgtip}/api/private/cli/snapshot?fields=vserver,volume,snapshot,create-time,size,snapmirror-label

 

ST123
1,905 Views

I didn't know the /private parameter, exactly what I was looking for, thanks! 

JohnChampion
1,849 Views

If you look at the top of the ONTAP REST API Online Reference (clusterip/docs/api) under "Features for all ONTAP APIs" the last topic "Using the private CLI passthrough with the ONTAP REST API" has a good description and some examples.

Public