Getting Started with Search

This will guide you through the specific parameters for search APIs

Searching with APIs

The search APIs let you search for specific values in a given attribute or collection of attributes, using a simple API.

Filtering

The available search operators are all and any:

  • all: AND operator, all of the conditions must be satisfied;
  • any: OR operator, any of the conditions may be satisfied;

The underlying objects for any search must include the the fields:

  • fact: the field name to filter by, this changes according to the object, check the API documentation to see the available fields for each of the entities;
  • operator: the operator to match the field's value (e.g.: blank, contains, startsWith); the available operations will be listed on the API documentation;
  • value: the value for the search, it can be optional depending of the chosen operator (such as blank);

📘

Important

all and any can be chained, but can't be at the same level.

Sorting

The results can be sorted using the sort operator, passing the following properties

  • fieldName: the field name to sort by, this changes according to the object, check the API documentation to see the available fields for each of the entities;
  • order: can be either asc or desc

Examples

A simple example searching payments from a given batch:

{
    "filter": {
        "all": [
            {"fact": "batchId", "operator": "equals", "value": "B-01JGXN6KJMDVDR87BHAE1E7KFM"}
        ]
    }
}

A complex example chaining all with any:

{
    "filter": {
        "all": [
            {"fact": "batchId", "operator": "equals", "value": "B-01JGXN6KJMDVDR87BHAE1E7KFM"},
            {
                "any": [
                    {"fact": "isSubmittable", "operator": "equals", "value": true},
                    {"fact": "isSubmittable", "operator": "equals", "value": false},
                    {"fact": "isSubmittable", "operator": "blank"}
                ]
            }
        ]
    },
  "sort": [{"fieldName":"auditInfo.createdAt", "order": "asc"}]
}