AnsweredAssumed Answered

Exploring UCS Director REST API

Question asked by brettkugler on Mar 17, 2014
Latest reply on Mar 18, 2014 by rekkrish

I'm doing some preliminary exploration of the UCS Director REST API and there seems to be two flavors.  The "legacy" API which supports JSON and seems to be what is primarily documented in the Developer Guide 4.1, and the Cloupia API, which is XML based and does not seem to be documented anywhere I can find.  I've tried exploring the API through the GUI with Developer Menu Options turned on, but even there I have had minimal success with the Cloupia tasks.  I've gotten a few to work as expected, but my main use case is still failing.

 

In short, I am trying to use a provisioning VM workflow but it's complaining (see error below).  I POST the following to /cloupia/api-v2/customActions

GUI Generated XML

<cuicOperationRequest>

<operationType>VMWARE_VM_PROVISION</operationType>

<payload>

<![CDATA[

<VMProvision>

 

 

<!-- Accepts value from the list: vmCloneType-->

<cloneType>cloneFromTemplate</cloneType>

 

 

   <!-- Set this value only when cloneType equals to cloneFromTemplate  -->

 

 

<!-- Accepts value from the list: catalog-->

<catalogId>14</catalogId>

 

 

   <!-- Set this value only when cloneType not equals to cloneFromTemplate  -->

 

 

<!-- Accepts value from the list: vm-->

<vmId>-1</vmId>

 

 

 

 

<!-- Accepts value from the list: vDC-->

<vdcId>2</vdcId>

 

 

   <!-- Set this value only when cloneType not equals to cloneFromTemplate  -->

 

 

<!-- Accepts value from the list: vdcCategoryType-->

<vdcCategory>0</vdcCategory>

 

 

<vmName>bkTestVM</vmName>

 

 

<allocatedHost></allocatedHost>

 

 

<allocatedDatastore></allocatedDatastore>

 

 

<allocatedAddnlDatastore></allocatedAddnlDatastore>

 

 

<allocatedCluster></allocatedCluster>

 

 

<allocatedResourcePool></allocatedResourcePool>

 

 

<altAllocatedHost></altAllocatedHost>

 

 

<altAllocatedDatastore></altAllocatedDatastore>

 

 

<altAllocatedAddnlDatastore></altAllocatedAddnlDatastore>

 

 

<altCluster></altCluster>

 

 

<altResourcePool></altResourcePool>

 

 

<ipAddressType>0</ipAddressType>

 

 

<ipAddress></ipAddress>

 

 

<allocatedAddnlIPAddress></allocatedAddnlIPAddress>

 

 

 

 

<!-- Accepts value from the list: vCPUCount-->

<numCPUs>4</numCPUs>

 

 

 

 

<!-- Accepts value from the list: memSizeMB-->

<memoryMB>4096</memoryMB>

 

 

 

 

<!-- Accepts value from the list: diskSizeGB-->

<diskGB>100</diskGB>

 

 

<maxWaitForIpMins>0</maxWaitForIpMins>

 

 

</VMProvision>

 

 

]]>

</payload>

</cuicOperationRequest>

 

and the response I get is

 

Response
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><cuicOperationResponse><errorMessage>No such SR exists in the system -1</errorMessage><operationStatus>3</operationStatus></cuicOperationResponse>

 

I suspect I have to take additional steps, but it's hard to say what I might be missing with no documentation.  Any pointers in the right direction?

 

Thanks,

Brett

Outcomes