• Complex Filtration

Complex Filtration

Objects (any entity that you can create a custom property for) have complex filtration feature, which allows you to filter by a property.

The structure of the complex filtration is as following:

complex_filters<OrGroup<AndGroup<AndObject>[]>[]>

Or, in query:

complex_filters[OrGroupIndex][AndGroupIndex][AndObjectKey]

So in JS it looks like this:

{
    complex_filters: [
        // this is OrGroup
        [
            // this is AndGroup
            [
                // this is AndObject
                {
                    field: string,
                    operation: string,
                    value: string|number|undefined,
                },
                // another AndObject
                {
                    field: string,
                    operation: string,
                    value: string|number|undefined,
                },
            ]
        ]
    ]
}

Where:

  1. field: is the internal name of a property.
  2. operation: exists | doesntExist | equal | notEqual | in | notIn | greater | less | lessOrEqual.
  3. value: value to compare with, required only when using comparable operation.

Example

This is a query to get all contacts who have 1. name = Mohammad and age < 30, or any contact with Marital Status known.

https://app.alaaqat.com/api/contacts?page=1&complex_filters[0][0][field]=firstname&complex_filters[0][0][operation]=equal&complex_filters[0][0][value]=Mohammad&complex_filters[0][1][field]=age&complex_filters[0][1][operation]=greater&complex_filters[0][1][value]=30&complex_filters[1][0][field]=marital_status&complex_filters[1][0][operation]=exists