Filtering

Filters allow to restrict the response of list endpoints. The available filter options for a supported list endpoint are returned by the filter options endpoint (e.g. /v3/assets/filter-options-v2).

Get asset list

POST https://api.akenza.io/v3/assets/list

Filter the asset inventory

Query Parameters

NameTypeDescription

page

Interger

Page number (default 0)

sort

String

Sort string (field, direction)

Request Body

NameTypeDescription

organizationId

String

Id of the organization

workspaceIds

List

List of workspace ids

expression

Expression

Filter expression

search

String

Search string

Endpoints that support the filter format described on this page:

  • get asset list (/v3/assets/list)

Filter options request

The filter options endpoint response contains information about the supported fields, their type, and supported predicates.

Filter options

The filter options part contains all filterable fields. Each option provides the applicable filterTypes and can list available values.

Definitions

The definitions define the supported predicates based on the filterType.

Supported Predicates

The supported predicates contain the supported predicates by filterType.

Predicates

Depending on the predicate a different amount of values are expected.

PredicateNumber of valuesExplanation

EQUALS

1

This predicate checks for an exact match. For strings, it is not case-sensitive

NOT_EQUALS

1

This predicate returns the inverse of EQUALS including null values

IN

1+

This predicate checks if one field value matches one of the values

NOT_IN

1+

This predicate returns the inverse of in

LESS_THAN

1

This predicate checks if the field value is less than the value

LESS_THAN_OR_EQUALS

1

This predicate checks if the field value is less than or equal to the value

LESS_THAN

1

This predicate checks if the field value is greater than the value

GREATER_THAN_OR_EQUALS

1

This predicate checks if the field value is greater than or equal to the value

BETWEEN

2

This predicate checks if the field value is between the two provided values. The order of values will automatically be ensured

CONTAINS_ALL

1+

This predicate checks that the field value contains all values

CONTAINS_NONE

1+

Works like NOT_IN but is used for list fields

CONTAINS_ANY

1+

Works like IN but is used for list fields

CONTAINS

1

This predicate checks if a string contains a given value

STARTS_WITH

1

This predicate checks if a string starts with a given value

ENDS_WITH

1

This predicate checks if a string ends with a given value

BEFORE

1

checks if a date is before the given value

AFTER

1

checks if a date is after the given value

IS_NULL

0

checks if a field value exists

IS_NOT_NULL

0

checks if a field value does not exist

Filter Expressions

There are two constructs that can be set as an expression, the expression list and a Filter.

A filter is has three fields, the field name, a predicate and a list of values. The amount of values differ by the used predicate.

{
    "field" : "id",
    "predicate" : "IN",
    "values": [
         "6600000000000000",
         "6600000000000001",
         "6600000000000002"
     ]
}

An expression list is used to combine multiple expressions and contains only two fields the operator and the a list of expressions. The operator which defines how the containing expressions are combined, it can be ether AND or OR. The expressions list has a max depth of 3.

{
  "operator": "AND",
  "expressions": [
    {
      "operator": "OR",
      "expressions": [
        ...
      ]
    },
    {
      "operator": "FILTER",
      "field": "uplinkMetrics.timestamp",
      "predicate": "BETWEEN",
      "values": [
        1693815659321,
        1693815359321
      ]
    },
    ...
  ]
}

Example:

{
    "search": "abc",
    "organizationId": "280000000000000",
    "expression": {
        "operator": "AND",
        "expressions": [
            {
                "field": "id",
                "predicate": "IN",
                "values": [
                    "0200000000000000",
                    "0200000000000001",
                    "0200000000000002"
                ]
            },
            {
                "operator": "OR",
                "expressions": [
                    {
                        "field": "name",
                        "predicate": "STARTS_WITH",
                        "values": [
                            "someething"
                        ]
                    },
                    {
                        "field": "name",
                        "predicate": "ENDS_WITH",
                        "values": [
                            "else"
                        ]
                    }
                ]
            }
        ]
    }
}

Last updated