VMware Cloud Community
oendelm
Enthusiast
Enthusiast
Jump to solution

vAPI Endpoint configuration - List all tags workflow example

Hi guys,

I'm trying to execute the workflow that list all tags (vapi/examples/vsphere folder), but I have a lot of questions...

How should I configure de vAPI? What is the vAPI endpoint? I run the add vAPI endpoint workflow with the url https://[vcenterServer]/rest but when I try to run the List all tags workflow I receive the error: 'ReferenceError: "com_vmware_cis_tagging_tag" is not defined'.

Is there another configuration that I should do? Is the vAPI url https://[vcenterServer]/rest? Do you have some example/tutorial about using the vAPI in orchestrator?

Thank you..

Tags (2)
1 Solution

Accepted Solutions
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

vAPI endpoint is a URL where a vAPI service can be accessed by client applications.

To configure vAPI plug-in, first you need to run the workflow 'Import vAPI metamodel' that imports vAPI model metadata and creates corresponding vRO scripting objects. After you have metamodel definitions imported, you can run 'Add vAPI endpoint' workflow.

Usually, you have one vAPI metamodel and one or more vAPI endpoints compatible with this metamodel. For example, you can import vSphere 6 vAPI metamodel, and then add many endpoints for each one of your vCenter server instances you want to connect to via vAPI.

vAPI service can expose several endpoints. vCenter vAPI provides both https://{vcenter.fqdn.name}/api and https://{vcenter.fqdn.name}/rest. With vRO vAPI plug-in you need to use the first format - https://{vcenter.fqdn.name}/api.

So, in your particular case, follow these steps:

  1. Run 'Import vAPI metamodel' workflow and provide https://{vcenter.fqdn.name}/api as an endpoint URL, username and password
  2. Run 'Add vAPI endpoint' workflow and provide https://{vcenter.fqdn.name}/api as an endpoint URL, username and password (the same you used for the import workflow)
  3. Run 'List all tags' sample workflow.


View solution in original post

5 Replies
iiliev
VMware Employee
VMware Employee
Jump to solution

Hi,

vAPI endpoint is a URL where a vAPI service can be accessed by client applications.

To configure vAPI plug-in, first you need to run the workflow 'Import vAPI metamodel' that imports vAPI model metadata and creates corresponding vRO scripting objects. After you have metamodel definitions imported, you can run 'Add vAPI endpoint' workflow.

Usually, you have one vAPI metamodel and one or more vAPI endpoints compatible with this metamodel. For example, you can import vSphere 6 vAPI metamodel, and then add many endpoints for each one of your vCenter server instances you want to connect to via vAPI.

vAPI service can expose several endpoints. vCenter vAPI provides both https://{vcenter.fqdn.name}/api and https://{vcenter.fqdn.name}/rest. With vRO vAPI plug-in you need to use the first format - https://{vcenter.fqdn.name}/api.

So, in your particular case, follow these steps:

  1. Run 'Import vAPI metamodel' workflow and provide https://{vcenter.fqdn.name}/api as an endpoint URL, username and password
  2. Run 'Add vAPI endpoint' workflow and provide https://{vcenter.fqdn.name}/api as an endpoint URL, username and password (the same you used for the import workflow)
  3. Run 'List all tags' sample workflow.


oendelm
Enthusiast
Enthusiast
Jump to solution

Hi,

Thank you very much for the explanation. I followed the steps but when I run 'List all tags' I have the error:

"com.vmware.vapi.std.errors.unauthenticated => {data=<unset>, messages=[com.vmware.vapi.std.localizable_message => {args=[], default_message=This method requires authentication., id=vapi.method.authentication.required}]} (Workflow:List all tags / Scriptable task (item1)#6)"

I used the same username and password at 'Import vAPI metamodel' and 'Add vAPI endpoint' workflows. Do you have some idea what may be? What am I doing wrong?

Thanks.

Reply
0 Kudos
iiliev
VMware Employee
VMware Employee
Jump to solution

Hmm, it seems vAPI service is failing to recognize authentication information.

Could you tell me the versions/build numbers of vRO, vAPI plug-in and vCenter/vSphere appliance you are using, to try to reproduce this in my environment?

Reply
0 Kudos
oendelm
Enthusiast
Enthusiast
Jump to solution

Hi,

I was using a user that apparently did not have permissions to do the operation. I've changed the user and everything is working now.

Thank you.

Reply
0 Kudos
Mikael_8313
Contributor
Contributor
Jump to solution

Hi

I have the same issue, I configured the VAPIEndpoint and Metamodel with administrator credential of vCenter. When I launch the workflow "List Tag" I have this error :

2018-02-21 14:20:17.227+0100 [WorkflowExecutorPool-Thread-10] ERROR {administrator@vsphere.local:Associate vSphere tag to VM:3bdcee06-b111-4b23-94aa-1fa11376f5c0:token=ff80808161b450490161b87a74110080} [SCRIPTING_LOG] [Associate vSphere tag to VM (2/21/18 14:08:08)] com.vmware.vapi.std.errors.internal_server_error => {data=<unset>, messages=[com.vmware.vapi.std.localizable_message => {args=[Rejecting login on a session where login failed], default_message=Provider method implementation threw unexpected exception: Rejecting login on a session where login failed, id=vapi.bindings.method.impl.unexpected}]} (Workflow:Associate vSphere tag to VM / Scriptable task (item1)#16)


Best Regard

Mikael

Reply
0 Kudos