ONTAP Rest API Discussions

Get Volumes Rest API not returning all volumes

kramar
2,636 Views

We are facing one strange issue. For some reason, we are not getting volume’s details through REST API.

For example, we have these 2 volumes in the cluster running 9.7P10:

us01cmsgrid::> vol show VG_ARCHIVE*                     

Vserver   Volume       Aggregate    State      Type       Size  Available Used%

--------- ------------ ------------ ---------- ---- ---------- ---------- -----

us01cmsgridvs1 VG_ARCHIVE -         online     RW        100TB    15.74TB   84%

us01cmsgridvs1 VG_ARCHIVE2 -        online     RW        100TB    69.79TB   30%

2 entries were displayed.

 

They are set up identically.

 

But when we make API call, only VG_ARCHIVE2 is showing up:

$ curl --location --request GET 'https://us01cmsgrid/api/storage/volumes' -k | grep -i "VG_ARCHIVE"

"name": "VG_ARCHIVE2",

 

$ curl --location --request GET 'https://us01cmsgrid/api/storage/volumes?name=VG*' -k

{

  "records": [

    {

      "uuid": "63f910f4-e7db-11ea-badf-d039ea14ccfe",

      "name": "VG_ARCHIVE2",

      "_links": {

        "self": {

          "href": "/api/storage/volumes/63f910f4-e7db-11ea-badf-d039ea14ccfe"

        }

      }

    }

  ],

  "num_records": 1,

  "_links": {

    "self": {

      "href": "/api/storage/volumes?name=VG*"

    }

  }

Am I missing something?

3 REPLIES 3

JohnChampion
2,559 Views

It might be having problems with the underscore "_" in the volume name. I did a few tests and depending on where I add the "*" I get different results - though it's either no volumes or all of them.  Why you would get only 1 volume is still a bit odd.  I found that if I add the wildcard on both sides of the underscore it works (ie. VG*_*).   Still - you'd think it would 'just work' 🤔  The NetappPub Slack channel (netapppub.slack.com #api) would be a good place to ask about this one.

ns-api-guru
2,249 Views

Hi,

 

Thanks but it still did not work even when I used "VG*_*". Also, we are calling "https://clustername/api/storage/volumes" in our scripts to get output for all volumes at once. We are trying to understand why that specific volume is not showing up there.

JohnChampion
2,243 Views

Do you get the same result when using Swagger?

 

Also, I've posted the question in the slack api channel.

Public