v3 - Filter syntax for /vms/list

Badge +6

The /vms/list V3 endpoint takes filters as one of it's options, though it isn't explained how to use those filters in the documentation or in the REST API Explorer.
The documentation shows: filter - string - optional - The filter used for the results.

I've tried using something like "vm_name=foo" and various other combinations, but each time I get:

{"api_version"=>"3.0", "code"=>400, "kind"=>"vm", "message_list"=>[{"message"=>"Given argument is invalid. Could not process given filter criteria.", "reason"=>"INVALID_ARGUMENT"}], "state"=>"ERROR"}

Does anyone have an example of the filter syntax?

Cheers, Gavin

Best answer by gsandie 31 October 2017, 12:36

I've figured out the syntax:vm_name==$thing_to_filter_on

View original

3 replies

Badge +6
I've figured out the syntax:vm_name==$thing_to_filter_on

Userlevel 7
Badge +34
Always cool when we are able to figure it out and share it back with the community - Thanks for sharing gsandie
Badge +6
You can also do "vm_name!=$thing_to_exclude" to filter on all vm_names apart from the ones you want to exclude.

Haven't figured out how to do a match on partials - e.g. "vm_name=~$thing_to_partial_match" - for those times you want to pull out a group of VMS with similar names.