issue creating disk with rest api using json format

I am unable to create disk using JSON however the same query in XML works great. In Json I get the following message back: { "detail": "For correct usage, see: https://ov1.butterflyit.com/ovirt-engine/apidoc#services/disks/methods/add", "reason": "Request syntactically incorrect." } Both use POST /ovirt-engine/api/disks and the content-type is either application/json or application/xml Here is the request in JSON: { "id": "866770c3-acf9-4f67-b72c-05ed241908e4", "name": "mydisk", "description": "test disk", "bootable": false, "shareable": true, "provisioned_size": 10240000000, "interface": "virtio", "format": "cow", "storage_domains": { "storage_domain": { "name": "VMS" } } } And here it is in XML <disk id="866770c3-acf9-4f67-b72c-05ed241908e4"> <bootable>false</bootable> <name>mydisk</name> <description>test Drive</description> <interface>virtio</interface> <provisioned_size>10240000000</provisioned_size> <format>cow</format> <storage_domains> <storage_domain> <name>VMS</name> </storage_domain> </storage_domains> </disk>

On Wednesday, 26 May 2021 04:27:27 CEST Pascal D wrote:
I am unable to create disk using JSON however the same query in XML works great. In Json I get the following message back: { "detail": "For correct usage, see: https://ov1.butterflyit.com/ovirt-engine/apidoc#services/disks/methods/add" , "reason": "Request syntactically incorrect." }
Both use POST /ovirt-engine/api/disks and the content-type is either application/json or application/xml
Here is the request in JSON:
{ "id": "866770c3-acf9-4f67-b72c-05ed241908e4", "name": "mydisk", "description": "test disk", "bootable": false, "shareable": true, "provisioned_size": 10240000000, "interface": "virtio", "format": "cow", "storage_domains": { "storage_domain": { "name": "VMS" } } }
I didn't try, but I guess you need { disk = { "id": "....", ... } }
And here it is in XML
<disk id="866770c3-acf9-4f67-b72c-05ed241908e4"> <bootable>false</bootable> <name>mydisk</name> <description>test Drive</description> <interface>virtio</interface> <provisioned_size>10240000000</provisioned_size> <format>cow</format> <storage_domains> <storage_domain> <name>VMS</name> </storage_domain> </storage_domains> </disk> _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/S7PPYRFB5AIRR BW5PMNTCMB2PTIF6FT2/

I tried all sort of ways and none work in json. However I have no problem creating a VM using json or other entities. It seems to me it could be a bug and this is why I am reporting in. I am using 4.3 by the way.
participants (2)
-
Pascal D
-
Vojtech Juranek