vROps

Quick Tip – vROps REST API requests using RegEx expressions

The vRealize Operations REST API allows using RegEx expressions in various GET methods.

Sometimes it is not clear how to use the expressions. Here a very simple example of using RegEx to retrieve vROps Virtual Machine objects, which have VM names starting with certain strings.

Encoded URL – example:

https://vrops-test.comp01.local/suite-api/api/resources?resourceKind=VirtualMachine&adapterKind=VMWARE&regex=s030v.*%7Cs030e.*%7CS030E.*

Example in Postman (of course, you need to replace the toke with a valid one):

https://vrops-test.comp01.local/suite-api/api/resources resourceKind=VirtualMachine&adapterKind=VMWARE&regex=s030v.*|s030e.*|S030E.*|S030V.*

And in Curl (of course, you need to replace the toke with a valid one):

curl -X GET \
 'https://vrops-test.comp01.local/suite-api/api/resources?resourceKind=VirtualMachine&adapterKind=VMWARE&regex=s030v.*%7Cs030e.*%7CS030E.*%7CS030V.*' \
 -H 'accept: application/json' \
 -H 'authorization: Basic xxxxxxxxxx \
 -H 'cache-control: no-cache' \
 -H 'content-type: application/json' \
 -H 'postman-token: yyyyyyyyyyyy'

it works perfectly and it is case sensitive.

Leave a Reply

Your email address will not be published.