REST API is different from CLI results
Applies to
- ONTAP
- REST
- Active Filesystem (AFS)
Issue
When executing REST calls to get snapshot usage information, it does not match the size
field displayed from the command line interface of ONTAP
The example below shows a REST and CLI output example demonstrating the size difference in the report:
svm1::> snap list -volume svm1_root -snapshot weekly.2024-03-01_1427 -fields blocks, size, usedblocks
vserver volume snapshot size blocks usedblocks
------- --------- ---------------------- ----- ------ ----------
svm1 svm1_root weekly.2024-03-01_1427 220KB 1% 34%
% curl --insecure -u vsadmin -X GET "https://10.61.87.72/api/storage/volumes/4ce95854-cf08-11ed-81ae-005056a034e0/snapshots?svm.name=svm1&fields=size&return_records=true&return_timeout=0" -H "accept: application/json" - "authorization: Basic dnNhZG1pbjpOZXRhcHAxIQ=="
Enter host password for user 'vsadmin':
{
"records": [
{
"uuid": "f22002fa-5626-4976-9ec7-8ecd74be1a4c",
"svm": {
"name": "svm1"
},
"name": "weekly.2024-03-01_1427",
"size": 348160
}
],
"num_records": 1,
"_links": {
"self": {
"href": "/api/storage/volumes/4ce95854-cf08-11ed-81ae-005056a034e0/snapshots?svm.name=svm1&fields=size&return_records=true&return_timeout=0"
},
"next": {
"href": "/api/storage/volumes/4ce95854-cf08-11ed-81ae-005056a034e0/snapshots?start.cpcount=11&start.uuid=f22002fa-5626-4976-9ec7-8ecd74be1a4c&svm.name=svm1&fields=size&return_records=true&return_timeout=0"
}
}