Quantcast
Channel: VMware Communities : All Content - All Communities
Viewing all articles
Browse latest Browse all 182126

com.vmware.vapi.std.errors.invalid_argument error

$
0
0

Hello Expert,

 

When I call rest api to create a disk for vm, the api response with an error body:

 

2018-04-17T13:47:42.539Z+08:00 ▶ INFO  >> e8da8850209f method: POST, path: rest/vcenter/vm/vm-xxxxx/hardware/disk, headers: map[content-type:application/json accept:application/json vmware-api-session-id:xxxxxxxxx], body: {"spec":{"type":"SCSI","ide":{"primary":true,"master":true},"scsi":{"bus":0,"unit":0},"sata":{"bus":0,"unit":0},"backing":{"type":""},"new_vmdk":{"name":"Hard disk 2","capacity":1073741824}}}

2018-04-17T13:47:42.945Z+08:00 ▶ ERRO  << e8da8850209f status: 400, response: {"type":"com.vmware.vapi.std.errors.invalid_argument","value":{"messages":[{"args":["com.vmware.vcenter.vm.hardware.disk.create_spec","sata"],"default_message":"Structure com.vmware.vcenter.vm.hardware.disk.create_spec has a union with a field not allowed for this case: sata","id":"vapi.data.structure.union.extra"}]}}

 

For your convenience of view, the request json body:

{

    "spec": {

        "backing": {

            "type": ""

        },

        "ide": {

            "master": true,

            "primary": true

        },

        "new_vmdk": {

            "capacity": 1073741824,

            "name": "Hard disk 2"

        },

        "sata": {

            "bus": 0,

            "unit": 0

        },

        "scsi": {

            "bus": 0,

            "unit": 0

        },

        "type": "SCSI"

    }

}

 

response:

{

    "type": "com.vmware.vapi.std.errors.invalid_argument",

    "value": {

        "messages": [

            {

                "args": [

                    "com.vmware.vcenter.vm.hardware.disk.create_spec",

                    "sata"

                ],

                "default_message": "Structure com.vmware.vcenter.vm.hardware.disk.create_spec has a union with a field not allowed for this case: sata",

                "id": "vapi.data.structure.union.extra"

            }

        ]

    }

}

 

 

What's wrong with my calling to the api? I also tried type: "IDE", reporting sata too, or type: "SATA", reporting "scsi"

 

Thanks for any advice.


Viewing all articles
Browse latest Browse all 182126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>