sschneid/vmpooler — pull request #16 by sschneid (2014-06-09 22:24:46+00:00)
Title: Batch requests

Support batch (multiple VM) requests

This PR allows a single API request to return multiple VM objects. It supports the following formats:

- POST /vm/
eg. 'curl -d '{"debian-7-i386":"3","debian-7-x86_64":"1"}' --url vmpooler/vm

Request contained in a JSON data hash POSTed to /vm

- POST /vm/(pool)+(pool)+(pool)...
eg. 'curl -d --url vmpooler/vm/debian-7-i386+debian-7-i386+debian-7-i386+debian-7-x86_64

Request contained in URL query string POSTed to /vm/(requested VMs)

Both commands listed above will return a JSON hash of 3 debian-7-i386 VMs and 1 debian-7-x86_64 VM:

{
"ok": true,
"debian-7-i386": {
"hostname": [
"v49pwwk5yzg6oad",
"ylghlgote5uso54",
"wt0c4xovvulo7ge"
]
},
"debian-7-x86_64": {
"hostname": "v3dkrulttp360fm"
}
}

Legacy-style requests for single VMs to /vm/(pool) will retain backwards compatibility.