VMware Networking Community
smcwilli
Contributor
Contributor

how to query for a virtualwire instance by name?

Hello,

I am relatively new to NSX, and to using REST APIs, so perhaps I am missing something obvious.  I would like to be able to query the NSX REST API to find a particular virtualwire instance by its name (not its ID).  I have tried the following GET request with no luck:

https://<nsx-manager-hostname>/api/2.0/vdn/virtualwires/?name=Web-Tier-1

Note that I am able to query all virtualwires by dropping the "?name=Web-Tier-1" part, and I am able to query on a particular virtualwire by its ID if I instead add the ID to the URL, e.g. "virtualwire-1".

If there is no way to query by name, then I will have to query all virtualwire and loop over the results to find the one with the name I am interested in, which seems absurd.

Thanks in advance.

0 Kudos
1 Reply
lvschie
Enthusiast
Enthusiast

As far as I can tell there is no way to query a virtualwire by name (it isn't referenced in the API guide either).

If you are using an automated way of doing the API calls you could try a regular expression to get the virtualwire-id, or, indeed,  iterate over all of them.

An alternative could be to query the portgroups in vCenter to match for the virtualwire name and then extract the virtualwire-id from the portgroup name, but that's an extra step you are probably not looking for 🙂

0 Kudos