Filters in an API request body
- 최종 업데이트2020/04/22
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.
-
Offset:
- Sort
-
"sort": [ { "field": "string", "direction": "<asc, desc>" }
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.