Register for the iXsystems Community to get an ad-free experience and exclusive discounts in our eBay Store.

Setting dataset quota through API

Jan 20, 2014
Unfortunately, the API is really limited. If you want the API to officially do your thing, , maybe you could try feature request?

If you really want to get it done, there are, include some very dangerous actions, something you could do to work with thing you could do.

The "best", out of API of course, would be try to simulate login process, get the session and cookies information, and then may be you could post the necessary information to you FreeNAS. Well, It is obviously just login GUI in programmatic way, but I would say it is the best things you could do.

Well, that's it if you want to stay "safe".
Mar 3, 2015
Thanks for your reply!

I was just checking out the possibility of doing it that way. It seems the "internal" API of FreeNAS is returning JSON data which makes it easy to parse and handle. Ofcourse through the official API would be the best, but this would work. Will definitely try a feature request. Should not be too hard to implement. :)
Jan 20, 2014
I have been studying the GUI, and I found that although many page have use JSON, some pages are rendered on the server-side. For example, the page showing system information is already rendered as HTML, which I feel kind of disappointed. Anyway, off-topic.

Hope your implementation goes well.
Sep 2, 2016
My solution is changing the API source code.

first open the ssh service of your server through the Web GUI
then, edit /usr/local/www/freenasUI/api/ like this
after that reboot your server

then request example as following:
POST /api/v1.0/storage/volume/tank/datasets/ HTTP/1.1
Content-Type: application/json
  "name": "foo",

if you still post data like:{"name":"foo"}, it will still create dataset with no quota limit.

I just add quota attribution of dataset.
if you want more attributions, you can refer to dataset_create function in gui/storage/, which is the create dataset action through Web GUI.