Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 189307

Re: Add a Metadata Filter to a vco Query

$
0
0

Hi Paul,

I never got any reply . I made a rest call using this in vco.

Probably you already know just pasting some little code... the below is what I did

https://x.x.x.x/api/query?type=organization&format=records&fields=metadata@SYSTEM:first&filter=metadata@SYSTEM:first==STRING:world

 

//var inParamtersValues = "query?type=organization&format=records&fields=metadata@SYSTEM:first&filter=metadata@SYSTEM:first==STRING:world";
var request = restHost.createRequest("GET", inParamtersValues+"&page="+page, null);
setLog("Request URL: " + request.fullUrl);

for each ( req in inParamtersValues){
System.log("Request: " + req);
}
request.setHeader("Accept" ,"application/*+xml;version=5.1");
request.setHeader("x-vcloud-authorization" , authHeader);
setLog("Request: " + request);
response = request.execute();

 

need to parse the response.

 

var doc = new XML(response.contentAsString);
default xml namespace = doc.namespace();
var recs = doc..AdminVMRecord;
setLog("rec----------" + doc..AdminVMRecord);

if(isEmptyObj(recs)) {
setLog(" No search found for this request...");
throw new customError("No search found for this request...");

}
else{
for (i in recs){  
setLog("---------------------------------");
setLog(recs[i].@href);
setLog(recs[i].@name);
setLog(recs[i].@vdc);
setLog(recs[i].@containerName);
setLog(recs[i].@container);

//vm
var vmReference = new VclReference() ;
vmReference.href = recs[i].@href;
var vm = vcdHost.getEntityByReference(VclFinderType.VM,vmReference);

........

Thanks,

Gayatri


Viewing all articles
Browse latest Browse all 189307

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>