ONTAP Rest API Discussions

Highlighted

Getting user quota details using REST API.

Hello all!

 

I'm not Storage Admin, but I've been requested to write some Web Page or something similar to show Storage Quota for each user.

In our company each user has his own Quota(~5000 user).

What I actually need is the correct HTTP REQUEST URL of REST API for specific user.

What I have already tried to use:

https://"netAppName"/api/storage/quota/reports?users.name="userName"&volume.name="volumeName"

 

The request above did bring this:

links": {

        "self": {

          "href": "/api/storage/quota/reports/"someGuid""

        }

 

Based on the "someGuid" above I  combined following HTTP REQUEST:

https://"netAppName"/api/storage/quota/reports/"someGuid"

This request did bring the "hard_limit", "soft_limit" and other user's information.

 

My question is: What does this "someGuid" mean? And how can I get Quota Information for specific user using one request and not multiple as in my example?

 

BR,

Pavel

 

2 REPLIES 2
Highlighted

Re: Getting user quota details using REST API.

Hi Pavel,

 

There's no particular meaning to "someGuid" in the response. It is a system-generated UUID which uniquely identifies that entry.

 

You can both search and get the additional information in one call by using a query like this:

https://"netAppName"/api/storage/quota/reports?users.name="userName"&volume.name="volumeName"&fields=*

 

That is, for any GET,  you can add the "fields" query parameter to request that certain fields of the object also be returned. By default, only key fields are returned (fields that identify the record) when you query a collection. This is in contrast to the default behavior  of an instance query (a request to a path that includes the identifier for a single record). For those requests, all fields are returned by default which is the behavior you saw.

 

Appending fields=* means that you want all the fields of the object (except for certain expensive to compute fields, to include those you would need fields=**). You could alternatively (and more efficiently) use fields=files if you only cared about the hard_limit and soft_limit, for example.

 

For more examples, look in the section of the REST documentation called "Requesting Specific Fields" which is near the top.

View solution in original post

Highlighted

Re: Getting user quota details using REST API.

Hello RobertBlackhart,

 

Thank you very, very much!

It worked for me!

 

You just can't imagine how long  I googled trying to find something to help me.

 

Thank you!

 

BR,

Pavel

Check out the KB!
Knowledge Base
All Community Forums