3 Replies Latest reply on May 1, 2019 5:23 AM by zops123

    vCloud API 31.0

    housamsmadi Novice

      Hi,

      I'm facing an issue with the vCloud API using JSON.

       

      I'm trying to update a virtual machine disk.

       

      When I retrieve the GET /vApp/{id}/virtualHardwareSection/disks I get in the Hard Disk 1 item the following hostresource

       

          "hostResource" : [ {

            "value" : "",

            "otherAttributes" : {

              "{http://www.vmware.com/vcloud/v1.5}storageProfileHref" : "https://exampledomain.com/api/vdcStorageProfile/61fe5387-8551-4fs9-927f-dd1b63a82b26",

              "{http://www.vmware.com/vcloud/v1.5}busType" : "6",

              "{http://www.vmware.com/vcloud/v1.5}busSubType" : "VirtualSCSI",

              "{http://www.vmware.com/vcloud/v1.5}capacity" : "10240",

              "{http://www.vmware.com/vcloud/v1.5}iops" : "0",

              "{http://www.vmware.com/vcloud/v1.5}storageProfileOverrideVmDefault" : "false"

            }

          } ],

       

      now updating the value of the "{http://www.vmware.com/vcloud/v1.5}capacity" and sending it back with a PUT request I get the following error message:

       

      {

        "otherAttributes" : { },

        "tenantError" : null,

        "stackTrace" : null,

        "majorErrorCode" : 400,

        "message" : "'capacity' attribute expected for element HostResource for rasd item with InstanceID=2000",

        "minorErrorCode" : "BAD_REQUEST",

        "vendorSpecificErrorCode" : null,

        "vcloudExtension" : [ ]

      }

       

      Is there anything I'm missing?

       

      Thanks in advanced.

      Housam Smadi

        • 1. Re: vCloud API 31.0
          sk84 Expert
          vExpert

          What exactly does your PUT request look like?

          • 2. Re: vCloud API 31.0
            housamsmadi Novice

            Hi,

             

            Here is the json put request:

            PUT /vApp/{id}/virtualHardwareSection/disks

             

            {

              "otherAttributes" : { },

              "link" : [ {

                "otherAttributes" : { },

                "href" : "https://domain.com/api/vApp/vm-529aa975-cbb3-448b-8240-f30350da184d/virtualHardwareSection/disks",

                "id" : null,

                "name" : null,

                "type" : "application/vnd.vmware.vcloud.rasdItemsList+xml",

                "rel" : "edit",

                "vcloudExtension" : [ ]

              } ],

              "href" : "https://domain.com/api/vApp/vm-529aa975-cbb3-448b-8240-f30350da184d/virtualHardwareSection/disks",

              "type" : "application/vnd.vmware.vcloud.rasdItemsList+xml",

              "item" : [ {

                "address" : {

                  "value" : "0",

                  "otherAttributes" : { }

                },

                "addressOnParent" : null,

                "allocationUnits" : null,

                "automaticAllocation" : null,

                "automaticDeallocation" : null,

                "caption" : null,

                "changeableType" : null,

                "configurationName" : null,

                "connection" : [ ],

                "consumerVisibility" : null,

                "description" : {

                  "value" : "SCSI Controller",

                  "otherAttributes" : { }

                },

                "elementName" : {

                  "value" : "SCSI Controller 0",

                  "otherAttributes" : { }

                },

                "generation" : null,

                "hostResource" : [ ],

                "instanceID" : {

                  "value" : "2",

                  "otherAttributes" : { }

                },

                "limit" : null,

                "mappingBehavior" : null,

                "otherResourceType" : null,

                "parent" : null,

                "poolID" : null,

                "reservation" : null,

                "resourceSubType" : {

                  "value" : "VirtualSCSI",

                  "otherAttributes" : { }

                },

                "resourceType" : {

                  "value" : "6",

                  "otherAttributes" : { }

                },

                "virtualQuantity" : null,

                "virtualQuantityUnits" : null,

                "weight" : null,

                "any" : [ ],

                "otherAttributes" : { },

                "bound" : null,

                "configuration" : null,

                "required" : true

              }, {

                "address" : null,

                "addressOnParent" : {

                  "value" : "0",

                  "otherAttributes" : { }

                },

                "allocationUnits" : null,

                "automaticAllocation" : null,

                "automaticDeallocation" : null,

                "caption" : null,

                "changeableType" : null,

                "configurationName" : null,

                "connection" : [ ],

                "consumerVisibility" : null,

                "description" : {

                  "value" : "Hard disk",

                  "otherAttributes" : { }

                },

                "elementName" : {

                  "value" : "Hard disk 1",

                  "otherAttributes" : { }

                },

                "generation" : null,

                "hostResource" : [ {

                  "value" : "",

                  "otherAttributes" : {

                    "{http://www.vmware.com/vcloud/v1.5}storageProfileHref" : "https://domain.com/api/vdcStorageProfile/61fe5987-8571-4a89-927f-dd2b6da82b26",

                    "{http://www.vmware.com/vcloud/v1.5}busType" : "6",

                    "{http://www.vmware.com/vcloud/v1.5}busSubType" : "VirtualSCSI",

                    "{http://www.vmware.com/vcloud/v1.5}capacity" : "20480",

                    "{http://www.vmware.com/vcloud/v1.5}iops" : "0",

                    "{http://www.vmware.com/vcloud/v1.5}storageProfileOverrideVmDefault" : "false"

                  }

                } ],

                "instanceID" : {

                  "value" : "2000",

                  "otherAttributes" : { }

                },

                "limit" : null,

                "mappingBehavior" : null,

                "otherResourceType" : null,

                "parent" : {

                  "value" : "2",

                  "otherAttributes" : { }

                },

                "poolID" : null,

                "reservation" : null,

                "resourceSubType" : null,

                "resourceType" : {

                  "value" : "17",

                  "otherAttributes" : { }

                },

                "virtualQuantity" : {

                  "value" : 10737418240,

                  "otherAttributes" : { }

                },

                "virtualQuantityUnits" : {

                  "value" : "byte",

                  "otherAttributes" : { }

                },

                "weight" : null,

                "any" : [ ],

                "otherAttributes" : { },

                "bound" : null,

                "configuration" : null,

                "required" : true

              }, {

                "address" : {

                  "value" : "1",

                  "otherAttributes" : { }

                },

                "addressOnParent" : null,

                "allocationUnits" : null,

                "automaticAllocation" : null,

                "automaticDeallocation" : null,

                "caption" : null,

                "changeableType" : null,

                "configurationName" : null,

                "connection" : [ ],

                "consumerVisibility" : null,

                "description" : {

                  "value" : "IDE Controller",

                  "otherAttributes" : { }

                },

                "elementName" : {

                  "value" : "IDE Controller 1",

                  "otherAttributes" : { }

                },

                "generation" : null,

                "hostResource" : [ ],

                "instanceID" : {

                  "value" : "3",

                  "otherAttributes" : { }

                },

                "limit" : null,

                "mappingBehavior" : null,

                "otherResourceType" : null,

                "parent" : null,

                "poolID" : null,

                "reservation" : null,

                "resourceSubType" : null,

                "resourceType" : {

                  "value" : "5",

                  "otherAttributes" : { }

                },

                "virtualQuantity" : null,

                "virtualQuantityUnits" : null,

                "weight" : null,

                "any" : [ ],

                "otherAttributes" : { },

                "bound" : null,

                "configuration" : null,

                "required" : true

              } ],

              "vcloudExtension" : [ ]

            }

             

            Thanks,

            Housam Smadi

            • 3. Re: vCloud API 31.0
              zops123 Lurker

              Hi Housam,

               

              Did you figure out what was wrong?

               

              I'm currently in the same boat - I would like to use t hew new json (api 31.0 part of vcloud 9.5 for service providers) instead of xml ideally and although it generally seems to be working there seems to be a quirk this this particular api call.

               

              Please let me know if you managed to solve this.

               

              Thanks.

              Regards,

              Zop