[pve-devel] API Return Values

Adam Krone adam.krone at thirdwavellc.com
Fri Oct 20 16:45:45 CEST 2017


Hi,

I'm building an API client in Go, as well as a Terraform provider that
consumes that client, and ran into an issue with the API that's preventing
me from building out one particular feature.

I've noticed that many (perhaps all?) non-GET methods return null, which is
unusual compared to many of the REST APIs I've worked with in the past.
This becomes a problem when consuming some of the API resources, primarily
those that have auto-generated ids (e.g. backups).

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.

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.

Is this something that could be added to the roadmap?

Thanks!



More information about the pve-devel mailing list