Querying vRO Workflows with the REST API and Multiple Conditions
Querying vRO workflows using the vRO REST API is relatively straightforward task. Use the below URL with a GET request and specify a condition to search for them, e.g. to find one by it’s name use:
https://vroserver.domain.local:8281/vco/api/workflows?conditions=name=test01
You should get a response similar to the following if a workflow of that name exists:
[javascript]
{ “link”: [ { “attributes”: [ { “value”: “https://vroserver.domain.local:8281/vco/api/workflows/cb9264b1-c832-4ee3-b95a-db73f7a2fedf/", “name”: “itemHref” }, { “value”: “cb9264b1-c832-4ee3-b95a-db73f7a2fedf”, “name”: “id” }, { “value”: “Test”, “name”: “categoryName” }, { “value”: “true”, “name”: “canExecute” }, { “value”: “https://vroserver.domain.local:8281/vco/api/catalog/System/WorkflowCategory/40281e864cebecc5014cebfdd3ab0f25/", “name”: “categoryHref” }, { “value”: “”, “name”: “description” }, { “value”: “Test01”, “name”: “name” }, { “value”: “false”, “name”: “customIcon” }, { “value”: “Workflow”, “name”: “type” }, { “value”: “true”, “name”: “canEdit” }, { “value”: “0.0.1”, “name”: “version” } ], “href”: “https://vroserver.domain.local:8281/vco/api/workflows/cb9264b1-c832-4ee3-b95a-db73f7a2fedf/", “rel”: “down” } ], “total”: 1 }
[/javascript]
I wanted to query with multiple conditions though, e.g. name and categoryName or version and categoryName. Possibly I’m not looking in the right place, but I couldn’t find any documentation or examples for the syntax of using multiple conditions:
A few attempts of trial and error revealed separating conditions with a comma is the way to go, for example:
- Look for workflows named New-Array in the vRO folder (categoryName) Test
https://vroserver.domain.local:8281/vco/api/workflows?conditions=categoryName=Test,name=New-Array
- Look for workflows in the vRO folder (categoryName) Test with version number 0.0.1
https://vroserver.domain.local:8281/vco/api/workflows?conditions=categoryName=test,version=0.0.1
Note: It’s worth bearing in mind Conditions are case sensitive, so categoryName not categoryname, otherwise the query will fail. Their associated values e.g Test or New-Array are not case sensitive.