Search in this section

Skip to end of metadata
Go to start of metadata


Table of Contents

Description

You use the ListInquire task to retrieve the data for several or all objects of an object type. The returned lists contain less details for the individual objects than the results of single queries.

A list query always consists of three elements:

  • The tag view defines the scope of the result.
  • The tag filters defines search criteria.
  • The tag orders defines the sorting of the result.

An example of a simple query is the Example 1.

Query Parameter keys

You can use the query parameter keys to determine additional details.

Example
POST /domain/_search?keys[]=$key1&keys[]=$key2

Possible Operators

List of possible operators for a list query:

Value

Meaning


eq

direct comparison (equal)

=

ne

is not  (not equal)

!=

like

Wildcard search

%

gt

greater then

>

lt

lower then

<

ge

greater or equal

>=

le

lower or equal

<=

Simple and complex Queries

More complex queries are possible with the help of the filters tag. Therefore several filters objects are created below the filters tag, which contain several conditions linked with "And" and/or "Or". Definition of the conditions in each filters object with key, an operator and corresponding values (value).

  • Example 1: Simple query with only one condition.
  • Example 2: Complex query with multiple conditions linked with "And".
  • Example 3: Complex query with multiple conditions linked to "OR".
  • Examplel 4: Complex query with multiple conditions linked to "And" and "OR"

Example 1: Simple query with only one condition.

List Request
{
    "filters": [
        {
            "key": "name",
            "operator": "LIKE",
            "value": "%json-test%"
        }
    ],
    "view": {
        "children": 1,
        "limit": 10
    },
    "orders": [
        {
            "key": "created",
            "type": "ASC"
        }
    ]
}

Example 2: Complex query with multiple conditions linked with "And".

List Request
{
    "filters": [
        {
            "key": "name",
            "operator": "LIKE",
            "value": "%json-test%"
        },
        {
            "key": "trustee",
            "operator": "EQUAL",
            "value": false
        }
    ],
    "view": {
        "children": 1,
        "limit": 10
    },
    "orders": [
        {
            "key": "created",
            "type": "ASC"
        }
    ]
}

Example 3: Complex query with multiple conditions linked with "OR".

List Request
{
    "filters": [
        {
			"link": "OR"
            "filters": [
        		{
            		"key": "name",
            		"operator": "LIKE",
            		"value": "%json-test%"
        		},
	        	{
            		"key": "trustee",
            		"operator": "EQUAL",
            		"value": false
        		}
			]
        }
    ],
    "view": {
        "children": 1,
        "limit": 10
    },
    "orders": [
        {
            "key": "created",
            "type": "ASC"
        }
    ]
}

Example 4: Complex query with multiple conditions linked with "And" and "OR"

List Request
{
    "filters": [
        {
            "link": "OR",
            "filters": [
                {
                    "key": "name",
                    "operator": "LIKE",
                    "value": "%json-test%"
                },
                {
					"link": "AND",
					"filters": [
						{
                      		"key": "comment",
                    		"operator": "LIKE",
                    		"value": "%on2%"
						},
						{
                      		"key": "create",
                    		"operator": "gt",
                    		"value": "2018-01-01 00:00:00"
						}
					]
                }
            ]
        },
        {
            "key": "trustee",
            "operator": "EQUAL",
            "value": false
        }
    ],
    "view": {
        "children": 1,
        "limit": 10
    },
    "orders": [
        {
            "key": "created",
            "type": "ASC"
        }
    ]
}