Enthusiast
Enthusiast

Querying tags using vAPI endpoint from vRO : HTTP response with status code 400 (enable debug logging for details)

I am trying to query tags on a vCenter cluster from vRO using vAPI endpoint. But I am receiving 400 error Refer to the below code

var client = endpoint.client();

//Creating cluster object using com_vmware_vapi_std_dynamic__ID

     var vapiObject = new com_vmware_vapi_std_dynamic__ID() ;

     vapiObject.id=cluster.id;

     vapiObject.type="ClusterComputeResource"

var objectToTags = new com_vmware_cis_tagging_tag__association(client) ;

//Retrieving tags associated with the object.

objectToTags.list_attached_tags(vapiObject)

Error : HTTP response with status code 400 (enable debug logging for details)

Not sure what I am missing here. Any help is greatly appreciated!.

4 Replies
VMware Employee
VMware Employee

The code looks correct to me.

Any info in vAPI endpoint logs (I think they can be found in vCenter appliance at /storage/log/vmware/vapi/endpoint) ?

Also, could you give more details about this environment, like versions of vRO / vCenter / vAPI plug-in? Have you tried to call some other vAPI methods, for example, could you try some of the example workflows that come out of the box with vAPI plug-in?

And one more thing to check - I think that vAPI has some rate limiting functionality, so is there any chance that you have made many requests to vAPI endpoint for a short period of time?

Enthusiast
Enthusiast

Hi Ilian,

I do not find any directory named vapi under /storage/log/vmware and I checked to see if it is under some other directory but could not find it.

Below are the versions in my environment.

vRO - v7.5

vCenter - v6.5

vAPI plug-in - v7.5

I did execute library workflow "List all Tags" and its giving me the same error

I have tried to query vAPI about 10-12 times in the last 5 hours. Do you think this is causing the issue?

0 Kudos
VMware Employee
VMware Employee

Hmm, the directory should be there. All of my vCenter appliances, versions 6.5 and 6.7, have it. Is it possible that you searched for it in your vRO appliance instead of your vCenter appliance?

10-12 API calls for 5 hours period is pretty low call rate so it should not cause any issues.

0 Kudos
Enthusiast
Enthusiast

My bad. I overlooked and checked vRO appliance instead of checking vCenter appliance. This morning I went through the logs and saw below warnings.

2019-06-17T10:53:47.219-04:00 | WARN  | state-manager1            | ApiConnectionsCisUtil          | Cannot find metadata source definitions in VAPI endpoint Service Endpoint of type com.vmware.cdc.provider with protocol vapi.json.http at http://localhost:16666/cls/

2019-06-17T10:53:47.219-04:00 | WARN  | state-manager1            | ApiConnectionsCisUtil          | Unable to find metadata endpoint in service Service with localization key cis.content-library.ServiceDescription and id 6d90cdad-046a-4b7f-9d15-554b5df770b2.

2019-06-17T10:53:47.219-04:00 | INFO  | state-manager1            | ApiConnectionsCisUtil          | Unsupported source (metadata) type in metadata source entry cis.common.ep.localurl : http://localhost:16666/cls/

2019-06-17T10:53:47.219-04:00 | WARN  | state-manager1            | ApiConnectionsCisUtil          | Unable to find metadata endpoint in service Service with localization key cis.vapi.endpoint.serviceDescriptionResourceKey and id cafae57b-bc69-450f-bde6-9df76639ac41.

2019-06-17T10:53:47.219-04:00 | INFO  | state-manager1            | ApiConnectionsCisUtil          | Unsupported source (metadata) type in metadata source entry cis.common.ep.localurl : http://localhost:12346/site/api

2019-06-17T10:53:47.219-04:00 | WARN  | state-manager1            | ApiConnectionsCisUtil          | Cannot find metadata source definitions in VAPI endpoint Service Endpoint of type com.vmware.vapi.endpoint with protocol vapi.json.http at http://localhost:12346/site/api

I thought there is some issue with vAPI metamodel, so I went ahead with removing the corresponding vAPI server from endpoint and metamodels. Post that I have added it again and now I don't see the errors anymore. Everything is working fine now.

Thank you for pointing me to the logs on vCenter Appliance.

0 Kudos