Using Postman.... is it possible to pass multiple vm's when making an API call to:
-find the resourceID's and only return the resourceID
-pass in the resourceID's to show the property "summary|parentvcenter" for each vm
Use case: We need to know the parent vcenter for 100 vm's located across multiple vcenters and multiple vROps instances via the API.... I know powershell will work, but what about Postman? Thanks.
E.g.,
https://vrops/suite-api/api/resources?resourceKind=virtualmachine&name=server1,server2,server3=resourceID
Then
No, that API does not support a query. You'd still need to use the POST /api/resources/properties/latest/query and just add the single resourceId in the body of the request.
This is how I would do that.
First, I would GET /api/resources?resourceKind=virtualmachine
I would then parse the response to find the VM resource IDs for the next call (just push into a JSON array). The reason I would do this is because today there isn't a way to find multiple resources by name (I'm actually going to get in touch with engineering about that). However, you CAN try a regex query instead, but I'm assuming this won't work for your use case.
Now, you will want to perform a query via POST /api/resources/properties/latest/query so you can provide detailed information for your query in the payload. In your case the payload would look like this in JSON:
{
"resourceIds" : ["resId1", "resId2", ... "resIdn"],
"propertyKeys" : ["summary|parentVcenter"]
}
In my lab, this returns...
{
"values": [
{
"resourceId": "9be74933-0b7f-4e99-86a8-bb758091daac",
"property-contents": {
"property-content": [
{
"statKey": "summary|parentVcenter",
"timestamps": [
1539953157902
],
"values": [
"WDC vCenter"
]
}
]
}
},
{
"resourceId": "17aa7577-31e5-4eac-99e3-d9086fe7b192",
"property-contents": {
"property-content": [
{
"statKey": "summary|parentVcenter",
"timestamps": [
1539953157902
],
"values": [
"WDC vCenter"
]
}
]
}
},
{
"resourceId": "07cbe100-c392-46a1-bee3-29e9e46b9922",
"property-contents": {
"property-content": [
{
"statKey": "summary|parentVcenter",
"timestamps": [
1539953157902
],
"values": [
"WDC vCenter"
]
}
]
}
},
{
"resourceId": "5af73da3-1317-40cf-b43f-2fe1f4b8f896",
"property-contents": {
"property-content": [
{
"statKey": "summary|parentVcenter",
"timestamps": [
1539699054453
],
"values": [
"WDC vCenter"
]
}
]
}
},
{
"resourceId": "d7b6fb65-07b3-43c1-96a5-329cb8435115",
"property-contents": {
"property-content": [
{
"statKey": "summary|parentVcenter",
"timestamps": [
1539953157902
],
"values": [
"WDC vCenter"
]
}
]
}
}
]
}
Thanks, John. This is helpful. What about when I have 1 vm and am using a browser or Curl and need 1 property returned? Something like this:
https://vrops/suite-api/api/resources/c97a7a49-879e-4b74-9ae9-e33599511589/properties?propertykey=su...
No, that API does not support a query. You'd still need to use the POST /api/resources/properties/latest/query and just add the single resourceId in the body of the request.