Content Where Condition

Some of the content APIs accept WhereCondition as request body for filtering data. This condition is quite similar to the SQL where condition. It is possible to build simple conditions like Column=Value, as well as complex conditions with grouping.

In order to build conditions it is necessary to know the entity name, relations among the entities and also the details about the entity fields. Those information can be found in Using the API to Fetch Project and Entity . Where conditions can be of 4 types. Here they are

Binary Condition

This is for creating Column (Operator) Value conditions.

Operators

These operators depends on the field types, like CONTAINS operator can be used with text/varchar fields only.

  • EQUALS

  • NOT_EQUAL

  • CONTAINS

  • STARTS_WITH

  • ENDS_WITH

  • NOT_LIKE

  • GREATER_THAN

  • GREATER_THAN_EQUAL

  • LESS_THAN

  • LESS_THAN_EQUAL

Example

{ "type": "binary", "value1": { "type": "column", "columnName": "arkivid" }, "operator": "EQUALS", "value2": { "type": "direct", "value": "319f07ba-e894-4a31-a731-62bc3cd18072", "castAs": "uuid" } }

When the value is uuid/date/timestamp need to use the proper castAs.

Unary Condition

This is for creating Column (Operator) conditions.

Operators

  • ISNULL

  • NOT_NULL

Example

{ "type": "unary", "value": { "type": "column", "columnName": "arkivid" }, "operator": "NOT_NULL" }

List Condition

This is for building condition with multiple values.

Operators

  • IN

  • NOT_IN

Example

{ "type": "list", "column": { "type": "column", "columnName": "arkivid" }, "listOperator": "IN", "values": { "type": "direct", "value": [ "319f07ba-e894-4a31-a731-62bc3cd18072" ], "castAs": "uuid" } }

When the values are uuid/date/timestamp need to use the proper castAs.

Combination Condition

This is for combining/grouping multiple conditions. It is also possible nest combination conditions.

Operators

  • AND

  • OR

Example