ONTAP Rest API Discussions

How do I discover all possible return values for a given REST object?

SCOTT_LINDLEY
3,874 Views

My immediate need is to determine all the possible values returned in the "type" field for a GET /storage/volumes/{volume.uuid}/files/{path} call. I can see from the examples that 2 of the possible returned values are "file" and "directory", but what are the other values? I can't find any of this sort of information in the doc/api link on the cluster, nor can I find any relevant reference on the NetApp support site. Please advise as to how to obtain this level of detail.

 

Thanks

1 ACCEPTED SOLUTION

JohnChampion
3,813 Views

It isn't readily obvious at all but hopefully this is what you're looking for...

 

Click the "Try it out" button, scroll down to the Responses section.  You 'll see the "Example Value | Model" label.  

Click on "Model" - then you can expand the details by clicking on the ">" arrows.  Drill down until you get to the info you're asking about.

JohnChampion_0-1618731961083.png

...so for your specific question...

"Model" -> records -> file_info -> "type" -> Array [9]

JohnChampion_1-1618732071334.png

 

Hope this is the information you're looking for.

 

 

 

View solution in original post

5 REPLIES 5

JohnChampion
3,814 Views

It isn't readily obvious at all but hopefully this is what you're looking for...

 

Click the "Try it out" button, scroll down to the Responses section.  You 'll see the "Example Value | Model" label.  

Click on "Model" - then you can expand the details by clicking on the ">" arrows.  Drill down until you get to the info you're asking about.

JohnChampion_0-1618731961083.png

...so for your specific question...

"Model" -> records -> file_info -> "type" -> Array [9]

JohnChampion_1-1618732071334.png

 

Hope this is the information you're looking for.

 

 

 

SCOTT_LINDLEY
3,780 Views

Thanks for the perfect answer! You're right, what this is is the exact opposite of "obvious", but at least it's there! I found exactly what I needed, and it's deeply appreciated. Thank you so much for taking the time to answer this for me!

SCOTT_LINDLEY
3,770 Views

So now I have another question:

 

In order to perform a "Try It Out" operation the API calls need some required parameters filled in. Where does one supply these parameters so the call can be "tried"? In the past these REST documentation pages (I forget what they're called, some nutty name or other 🙂 ) had a field that you could use to input parameter values in when you tried a call, but these seem to be missing said fields.

 

I'm using the "docs/api" link on 9.7P7 and 9.8P1 clusters, and I've tried both IE and Chrome. Is there a "secret sauce" to getting these input fields to appear? Otherwise, how does one supply the required parameters to the API calls in order to try them out?

JohnChampion
3,767 Views

The nutty name you're thinking of is "Swagger" - I think...  🤔

 

After selecting "Try it out", the interface should provide drop downs and text boxes for values  appended to the URL string as well as present the JSON body in an editable text box.  You can look at the Model to see what's required, minimum, etc.  I usually copy/save the example JSON (as a comment in code) to keep the full body then edit out what I don't need and give it a run to see the results.  After execution, Swagger will show you the curl command and full URL for the request and the results.

 

I do wish it allowed the addition of query fields on the URL but you can always run those separately in the browser or with curl (or Postman). 

 

The "Features for all ONTAP APIs" section at the top is well worth a read.

 

 

SCOTT_LINDLEY
3,759 Views

Do you know how many times I tried the "Try It Now" button and nothing happened? On both IE and Chrome too. Now you "say it out loud", I read it, and like magic it works. Wow. Facepalm to the forehead. Bang the head on the wall. I'd give 2 valuable nickels to know why I spent an hour trying to this get to work, then I read 2 paragraphs, so the same thing, and it works. Just wow.

 

Thanks for the assist.

 

Wow...

Public