[pve-devel] API Return Values

Dietmar Maurer dietmar at proxmox.com
Fri Oct 20 17:16:34 CEST 2017


> If I'm managing containers or groups, for example, this isn't a problem as
> they both have user-defined ids (vmid, groupid). After a quick browse of
> the API documentation, this appears to be the case for most of the
> resources. If I'm managing backups, however, the API generates the id, and
> it looks like the only way to retrieve the id from the API is by listing
> all backups.

You are right. The primary purpose of those APIs was the use with the GUI, so
this was never an issue for us.

> In general, I don't see how I could reliably determine which is the
> resource I just created, especially if it's possible for multiple resources
> to only differ by their ids. It would be a lot easier if the non-GET
> methods could return the object (with the auto-generated id, in this case),
> just as it is returned when making a GET request. Alternatively, the
> response could return just the ID of the backup, similar to how container
> actions return the task's upid.

Returning an ID is not an ideal solution, because an API call can fail. In
that case you do not know the ID anyways, but the resource could be 
created anyways (i.e in case of network problems).

But why do you need to know the backup ID exactly?



More information about the pve-devel mailing list