VMware Cloud Community
dlarosa11
Enthusiast
Enthusiast

getting sdk_object parameters

I'm creating REST calls to execute workflows in VRO.  Let's say I want to input the network which is a VC:DistributedVirtualPortgroup object in vro.  I need to pass in the sdk_object.  The sdk_object has an href.  My question is this. 

Is there a reference or place I can browse to get all the hrefs I'll need for the different possible values that can be input?  I have multiple object types that we'll input.

Better yet, is there a way to convert a string into the internal object so that I don't have to manage this mapping from the tool I'm writing to make the REST call to start the workflow?

Tx Dom

4 Replies
iiliev
VMware Employee
VMware Employee

Hi Dom,

I think it would be easier to use SDK objects providing object type and object ID instead of object href.

Object types (in your example, VC:DistributedVirtualPortgroup) are the types defined by certain vRO plug-in. You can browse the available types in your vRO instance by opening vRO API Explorer (vRO Java Client -> Tools -> API Explorer). Near the end of the tree view in the top left part are tree nodes for all deployed vRO plug-ins.

Format of the object ID is specific for each plug-in. You can find the ID of particular object in vRO Java client's inventory browser (for plug-ins that provide inventory hierarchy). Or you can write some Javascript code to enumerate all objects of a given type and dump their IDs. Or you can create a vRO workflow that has input parameter of this type, execute it (selecting the desired object instance), and then print the selected object ID.

BTW, if you haven't found it already, you may want to check Burke's tutorial at https://www.vcoteam.info/articles/learn-vco/268-how-to-use-the-rest-api-to-start-a-workflow.html

dlarosa11
Enthusiast
Enthusiast

Thanks for the reply.  I used that as a great primer for getting started.

Are you saying I can just specify the id and type?  If so, I'll still need to get there values and will follow your steps to do so if they still apply.

I set the sdk object with all three.  Tell me the minimum I need and I'll use it.

  "vro_objects": {

    "OEL72_APP": {

      "type": "VC:VirtualMachine",

      "href": "https://vm-prd01vro:8281/vco/api/catalog/VC/VirtualMachine/corpvs4.corp.unifirst.com%252Fvm-1068664/",

      "id":   "corpvs4.corp.unifirst.com/vm-1068664"

    },

    "dvPortGroup200": {

      "type": "VC:DistributedVirtualPortgroup",

      "href": "https://vm-prd01vro:8281/vco/api/catalog/VC/DistributedVirtualPortgroup/corpvs4.corp.unifirst.com%25...",

      "id":   "corpvs4.corp.unifirst.com/dvportgroup-784200"

    },

  "vm": {

  "type": "VC:VmFolder",

      "href": "https://vm-prd01vro:8281/vco/api/catalog/VC/VmFolder/corpvs4.corp.unifirst.com%252Fgroup-v723610/",

      "id": "corpvs4.corp.unifirst.com/group-v990673"

  }

  },

Tx Dom

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee

You can specify sdk object by either passing only a href, or by passing type and id. No need to specify all 3 of them - href, type and id.

Reply
0 Kudos
dlarosa11
Enthusiast
Enthusiast

Thank you.  One less thing to maintain.  Still need to lookup the ids.  Will keep searching for a way to reflect a string into vmware type.  If it doesn't exist, it would be nice to have.

Reply
0 Kudos