Skip to content

Asset Management Service – Filtering

All endpoints with the parameter filter support basic filtering.

When reading assets, all assets are filtered for main tenant and subtenant. In addition, you can supply one or more of the following field names in the filter queries:

  • assetId
  • tenantId
  • name
  • externalId
  • subTenant
  • deleted
  • parentId
  • typeId
  • hasType (see also Special fields)

Wildcards are not supported. Timestamps must be in the following format: 2018-01-01T00:00:00.00Z

When a filter has no matches, the response will be empty.

Filter functions

Function eq (equals)

1
2
3
{
  "name": "MyMotor"
}

or

1
2
3
4
5
{
  "name": {
    "eq": "MyMotor"
  }
}

Function in

The function in is very similar to equals, but instead matching to one value, it checks an array of values, and matches for any of them.

1
2
3
4
5
6
7
{
    "name": {
        "in": {
            "value": ["MyMotor", "MyEngine"]
        }
    }
}

Function endsWith

1
2
3
4
5
{
    "name": {
        "endsWith": "Motor"
    }
}

Function startsWith

1
2
3
4
5
{
    "name": {
        "startsWith": "My"
    }
}

Function contains

1
2
3
4
5
{
    "name": {
        "contains": "yMot"
    }
}

Function before

1
2
3
4
5
{
    "deleted": {
        "before": "2018-01-01T00:00:00.00Z"
    }
}

Function after

1
2
3
4
5
{
    "deleted": {
        "after": "2018-01-01T00:00:00.00Z"
    }
}

Function between

1
2
3
4
5
{
    "deleted": {
        "between": "[2018-01-01T00:00:00.00Z, 2018-01-31T00:00:00.00Z)"
    }
}

Filter operations

Operation not

1
2
3
4
5
6
7
{
  "not": {
      "name": {
        "startsWith": "My"
      }
  }
}

or

1
2
3
4
5
{
  "not": {
    "name":"MyMotor"
    }
}

Operation or

1
2
3
4
5
6
7
8
{
    "name": {
        "or": [
            {"eq": "MyMotor"},
            {"endsWith": "Motor"}
        ]
    }
}

or

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
    "or": {
        "deleted": {
            "eq": null
        },
        "name": {
            "startsWith": "My"
        }
    }
}

Operation and

1
2
3
4
{
    "name":"MyMotor",
    "deleted": null
}

or

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
{
    "and":{
      "deleted": {
          "eq": null
      },
      "name": {
          "startsWith": "My"
      }
    }
}

Special fields

Field hasType

Using hasType you can filter for any asset type and its descendants. E.g., all assets of type core.motor or of any type which is derived from the asset type core.motor.

1
2
3
{
  "hasType": "core.motor"
}

Note

While hasType matches for any asset type in the type hierarchy, the field typeId only matches with the given asset's typeId and thus does not return descendants.

Any questions left?

Ask the community


Except where otherwise noted, content on this site is licensed under the MindSphere Development License Agreement.