Dynamic filters

The filtering system allows you to refine query results precisely. All filters applied in a single request are combined using AND logic, meaning results must match every condition simultaneously.

Refine the results of any GET query by adding filters directly to the request URL.

⚠️

Availability: Dynamic filters are not enabled on all endpoints. You can only use them on endpoints that explicitly indicate filter support in their reference documentation. Check each endpoint's page to verify whether it supports filters and which fields are available.

🔷 How do filters work?

All filters applied in a single request are evaluated using AND logic. This means the results returned will only include records that match all conditions simultaneously.

🔷 Filter structure

Each filter consists of three parts: the field name, the comparison operator, and the desired value.

Standard format:

field[operator]=value

Example: Search for work orders with status "open" and cost greater than or equal to 100:

GET https://app.fracttal.com/api/work_orders?status[eq]=open&cost[gte]=100

🔷 Available operators

Below are the allowed operators grouped by the data type of the field (text, numbers, or dates).

OperatorDescriptionSupported data types
eqExact equalitytext, number, date, boolean
neqNot equal totext, number, date, boolean
gtGreater thannumber, date
gteGreater than or equal tonumber, date
ltLess thannumber, date
lteLess than or equal tonumber, date
likePartial search (contains text)text
betweenRange between two valuesnumber, date
inList of values (comma-separated)numbers only

🔷 How operators work

Equality and Difference

Searches for an exact match (eq) or excludes specific records (neq).

Examples:

  • ?id[eq]=3 (Only the record with ID 3)
  • ?id[neq]=1 (All records except ID 1)
  • ?status[eq]=open (Work orders with status "open")

🔷 Multiple filters

Combine multiple conditions in a single request using the & symbol. The system returns only records that match all conditions at once.

Example: Search for work orders that are not #3, with cost less than 500 and description containing "urgent":

GET https://app.fracttal.com/api/work_orders?id[neq]=3&cost[lt]=500&description[like]=urgent

🔷 Date filtering

Dates are one of the most commonly used filters. The API expects dates in ISO 8601 format: YYYY-MM-DDTHH:MM:SS±UTC.

Filter work orders created in January 2024:

GET https://app.fracttal.com/api/work_orders?date[between]=2024-01-01T00:00:00-05,2024-01-31T23:59:59-05

🔷 Complete request and response example

Below is a real request with applied filters and the possible responses.

Request: Get work orders with status "open" and cost greater than or equal to 100:

curl -X GET "https://app.fracttal.com/api/work_orders?status[eq]=open&cost[gte]=100" \
  -H "Authorization: Bearer YOUR_TOKEN"
{
  "success": true,
  "message": "OK",
  "data": [
    {
      "wo_folio": "WO-001234",
      "description": "Preventive maintenance hydraulic pump",
      "status": "open",
      "cost": 250.00,
      "date": "2024-03-15T10:30:00-05"
    },
    {
      "wo_folio": "WO-001289",
      "description": "Electrical system inspection north plant",
      "status": "open",
      "cost": 180.50,
      "date": "2024-03-20T08:00:00-05"
    }
  ],
  "total": 2
}

🔷 Common errors and solutions

ErrorCauseSolution
Incompatible operator with data typeUsing like on a numeric field or in on a text fieldCheck the operators table and verify the supported data types for each operator
Too many filtersSending more than 20 filters in a single requestReduce the number of conditions or split the query into multiple requests
Too many values in inSending more than 100 values in an in listSplit the values into multiple requests with lists of 100 or fewer
Incorrect date formatNot following the ISO 8601 format (YYYY-MM-DDTHH:MM:SS±UTC)Use the correct format: 2024-01-01T00:00:00-05
Timezone with unencoded +Writing +02 instead of %2B02 in the URLEncode the + sign as %2B
Incorrect between valuesSending more or fewer than 2 comma-separated valuesMake sure to send exactly two values: ?field[between]=min,max

🔷 Filterable fields per endpoint

📌

Not all endpoints support the same filterable fields. The available fields depend on the resource you are querying. Check the reference documentation for each endpoint to find out which specific fields it accepts as filters.

For example:

  • Work orders (/work_orders): status, cost, date, description, among others.
  • Assets (/items): code, description, status, among others.
  • Meters (/meters): code, serial, among others.

🔷 Sorting and pagination

Filters can be combined with sorting and pagination parameters to control results precisely.

Available parameters:

ParameterDescriptionExample
sortField to sort results bysort=date
orderSort direction: asc (ascending) or desc (descending)order=desc
pageResults page numberpage=1
limitMaximum number of records per pagelimit=50

Complete example: Get work orders with status "open", sorted by date descending, showing 20 results per page:

GET https://app.fracttal.com/api/work_orders?status[eq]=open&sort=date&order=desc&page=1&limit=20

🔷 Fracttal context examples

Filter by status and date range:

GET https://app.fracttal.com/api/work_orders?status[eq]=open&date[gte]=2024-01-01T00:00:00-05&date[lte]=2024-03-31T23:59:59-05

Search by description and minimum cost:

GET https://app.fracttal.com/api/work_orders?description[like]=preventive&cost[gte]=500

🔷 Important considerations

💡

Validation rules

  • Condition limit: A maximum of 20 filters per request is allowed.
  • List limit (IN): The in operator allows a maximum of 100 values per list.
  • Compatibility: Make sure to use the correct operator for the data type. For example, trying to use like on a price field or in on a description field will generate a validation error.
  • Special characters in dates: When filtering by dates that include timezones with the plus sign (+), it must be written as %2B.
    • Correct: ?date[gt]=2024-01-01T00:00:00%2B02