Getting free space via API no longer works

I am using Nextcloud via a hosted solution with Hetzner Storage Share. Earlier this week, they upgraded to version 31.0.8. I think this may have made a small change to the way the APIs work, which has broken something I use.

I have been using the Python API (from an Ubuntu 24.04 server) to periodically check how much free space I have and warn me if I am approaching my limits. I did this by calling the get_user() function of the Python API, which returns a JSON collection of information about my account. If I look within that JSON at [‘quota’][‘free’] it would give me the number of bytes of free space I have, which is what I need.

In the last couple of days, that behaviour has changed, which I assume (though can’t be 100% sure) is a result of the upgrade to 31.0.8.

Now, the free space is reported as -3, which I believe is a code for “unlimited”.

I have attempted to work around that by setting my user quota to 5 TB, which is the total space I have available on my storage plan.

Now it does report the number of bytes of free space, but it’s different from before: previously, it was what was left not only after my active files, but also any deleted files that hadn’t yet been permanently deleted.

Now the free space doesn’t take account of the deleted files, and reports all the free space that would be left if all my deleted files were to be permanently deleted.

I like keeping my deleted files for a little while in case of mishaps, so including them in the space calculation seems necessary.

Is there any way in which I can use the Python API to calculate how much free space I actually have, rather than how much free space I would hypothetically have if I were to immediately permanently delete all my deleted files?

Many thanks in advance.

You have here the documentation:

that did not change recently (2 years ago).

Now, the current behavior looks like it is supposed to work, only if a quota is set you are limited. And how it was before, was not correct (compared to the documentation), so they probably fixed it.

Regarding the “unlimited” or not, If you have a large storage, it can make sense to have logical volume management, and then “grow” partitions (which can span over several disks) when the need arises.

Versioning and deleted files are managed dynamically and deletes files when the space is needed:

not sure if you disable the autoclean of the trash bin if that changes.

You only have access through the Nextcloud-API, not to the system itself?

For the free space of the system, the API of the serverinfo-app could be an option:

1 Like

Many thanks for the detailed reply.

Ah, how ironic that I was relying on something that was actually a bug.

I don’t think that’s within my gift. I don’t host Nextcloud myself, it’s all managed by Hetzner. I’m expect they manage their partitions as they see fit without my having any say in it.

Possibly, but I don’t want to disable autoclean of the trash. My desired behaviour is that things will stay in the trash for a while but eventually get deleted so that I don’t use up all my space.

More or less. I can view things through a web console, but I don’t have root access to the system. And in fact I can see the free space on the web console, but as far as I know that’s not something I can automate and check at regular intervals.

Thanks, that looks like it may well give me what I need, if I can run it. Do you know if it’s possible to run it if I’m not a server admin?

If your user sees the admin settings, then the entry “System” shows everything in the interface. If you have access to this, then it should also be possible via API.
It might be possible that via php settings, some information are blocked.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.