Product SiteDocumentation Site

8.2.3.  Search Queries

A collection is queried using a GET request on an appropriate "collection/search" URI template, instantiated with a query constraint expressed in the Red Hat Enterprise Virtualization Manager query language. Only those resources in the collection satisfying the constraint will be returned.
GET /rhevm-api/{collection}?search={query} HTTP/1.1
Accept: application/xml

HTTP/1.1 200 OK
Content-Type: application/xml

<{collection}>
    <{resource} id="{resource_id}" href="/rhevm-api/{collection}/{resource_id}">
        ...
    </{resource}>
    ...
</{collection}>

8.2.3.1. Query Syntax

The API uses the following syntax to perform search queries with a GET request:
GET /rhevm-api/{collection}?search={query} HTTP/1.1
Accept: application/xml
The query refers to the search query the API directs to the collection. This query takes the following form:
{property} {operator} {value}
The property refers to any element within the collection that contains a searchable value. For example, a search for a virtual machine name in the vms collection requires the name property.
The operator is a comparison operation between your chosen value and the property value. The API requires this operator to be URL encoded. The following table lists the API's supported operators and their URL encoded equivalents:
Description Operator URL Encoded
is equal to = %3D
The value refers to the value contained within the chosen property. For example, to search for a virtual machine named "vm1", the value would need to be vm1.
The combined collection and query examples produce the following search query:
GET /rhevm-api/vms?search=name%3Dvm1 HTTP/1.1
Accept: application/xml