Filters in an API request body

Filtering provides basic conditional queries and page control for processing web pages. There are 3 basic features related to filtering: filtering conditions, sorting columns, and pagination parameters.

Here is a representation of the JSON filtering structure used in the Automation Anywhere APIs.
{
  "filter": {
    "operator": "NONE",
    "operands": [
      null
    ],
    "field": "string",
    "value": "string"
  },
  "sort": [
    {
      "field": "string",
      "direction": "asc"
    }
  ],
  "page": {
    "offset": 0,
    "length": 0
  }
}
The most basic part of this JSON object is the filter array.

Understanding filters

Basic filter
Filters can be used search for a single condition or they can be wrapped in logical operands AND and OR. Filtering can be a simple conditional evaluation of a single field. The operator, field, and value used in a filter are specific to the API they are used in.
Note: Values in the angle brackets < > include a list of all potential values. There should be only one value for each parameter.
Single parameter filter
{
  "filter": {
    "operator": "<NONE, lt, le, eq, ne, ge, gt, substring, and, or, not>",
    "field": "string",
    "value": "string"
  }
}
Two parameter filter
{
  "filter": {
    "operator": "<and, or>",
    "operands": [
      {
        "operator": "<NONE, lt, le, eq, ne, ge, gt, substring, and, or, not>",
        "field": "string",
        "value": "string"
      },
      {
        "operator": "<NONE, lt, le, eq, ne, ge, gt, substring, and, or, not>",
        "field": "string",
        "value": "string"
      }
    ]
  }
}
Page
"page":{ 
    "offset":0,
    "length":0
}
Pagination rules parameters
  • Offset:

    Type: integer

    The numeric value that indicates how many rows into a table that the filter starts evaluating.

  • Length

    Type: integer

    The number of lines that are returned in a single page of results.

Sort
 "sort": [
    {
      "field": "string",
      "direction": "<asc, desc>"
    }
  • Field: The field that you want the results to be filtered by. This must be a supported filterable field. Filterable fields vary depending on the API.
  • Direction

    Type: Enum [ desc, asc ]

    • asc = ascending (smallest to largest, 0 to 9, A to Z)
    • desc = descending (largest to smallest, 9 to 0, Z to A)

API filter examples

Audit API filter example with createdOn and userName fields
Create a filter that finds audit log entries for a specified date range for users with a specific string in their userName.