Created attachment 1080990 [details] full error and exception Description of problem: REST: can not create a VM disk via json (it's possible via XML fine) Version-Release number of selected component (if applicable): rhevm-backend-3.6.0-0.18.el6.noarch rhevm-restapi-3.6.0-0.18.el6.noarch How reproducible: always Steps to Reproduce (substitute VM and SD UUIDs for yours): 1. try to create a VM disk using xml api: $ curl -b .cookies/rhevm36-user -H 'filter: true' -H 'prefer: persistent-auth' https://rhevm36.example.com/ovirt-engine/api/vms/b2c9f0ca-6d8a-46c9-9503-de8e0484fa76/disks -X POST -H 'content-type: application/xml' -d '<disk><storage_domains><storage_domain id="a57f4682-87be-4902-92ee-0223ae3537be"/></storage_domains><provisioned_size>12884901888</provisioned_size><type>system</type><interface>virtio_scsi</interface><format>cow</format><bootable>false</bootable></disk>' 2. do exactly the same request using json: $ curl -b .cookies/rhevm36-user -H 'filter: true' -H 'prefer: persistent-auth' https://rhevm36.example.com/ovirt-engine/api/vms/b2c9f0ca-6d8a-46c9-9503-de8e0484fa76/disks -X POST -H 'content-type: application/json' -d '{ "storage_domains": {"storage_domain": {"id": "a57f4682-87be-4902-92ee-0223ae3537be"}}, "provisioned_size": "12884901888", "type": "system", "interface": "virtio_scsi", "format": "cow", "bootable": "false" }' Actual results: 1. works 2. returns: * "Request syntactically incorrect." message * log: > ... Can not deserialize instance of java.util.ArrayList out of START_OBJECT token > line: 1, column: 23] (through reference chain: org.ovirt.engine.api.model.Disk["storage_domains"]->org.ovirt.engine.api.model.StorageDomains["storage_domain"] Expected results: the two commands work exactly the same Additional info:
*** Bug 1269899 has been marked as a duplicate of this bug. ***
Those two requests aren't identical. In the JSON version the "storage_domain" element is an object, but it should be an array: { "storage_domains": { "storage_domain": [ { "id": "a57f4682-87be-4902-92ee-0223ae3537be" } ], }, "provisioned_size": "12884901888", "type": "system", "interface": "virtio_scsi", "format": "cow", "bootable": "false" } When in doubt about the format create the object using XML, or the GUI, and then request it with JSON format. You can do that in your browser, using an URL like the following: https://.../api/vms/{vm:id}/disks/{disk:id}?accept=application/json Test this and close the bug as NOTABUG if it works correctly.
> In the JSON version the "storage_domain" element is an object, but it should be an array Yeah, bracket additions under storage_domains fixed the request for me.