@MathieuRA I can’t find any documentation of /tasks/ in swagger, I am on the newest Version of XOA
Posts
-
RE: REST API create_vm returns task URL that doesn't exist?
-
REST API create_vm returns task URL that doesn't exist?
Hi everyone,
I'm currently creating VMs via the REST API endpoint:
POST /rest/v0/pools/${poolId}/actions/create_vm
Everything works great so far, but since I'm managing VMs externally via my own panel, I need the UUID of the newly created VM as part of the response.
Right now, my workaround is to cache all existing VMs beforehand, use a very unique name (including a timestamp) when creating the VM, and then scan all VMs afterward to find the new one by matching the name — from which I can extract the UUID. This works, but it's far from efficient, especially since I have to query every single VM individually to get the name_label.
However, I noticed that the API call returns something like this:
XOA success response: "/rest/v0/tasks/0mcmb9kba"
But as far as I can tell, there is no /rest/v0/tasks endpoint available in the REST API. So... why does create_vm return a reference to a resource that doesn't exist?
I was quite excited at first, thinking this would let me track the task and maybe get the VM UUID without extra API calls — but it seems like a dead end.
@devs – Is there any timeline on when this /tasks route will be available? And in the meantime, could you consider not returning references to non-existent endpoints? It's a bit misleading and made me waste some time debugging something that doesn't exist (yet?).
Thanks in advance!