URL Filtering Guidelines

In this section, user can find different info of generic code that can be found in different API endpoints.
We are trying to bring closer how our system works, so this might be incredibly useful content.

We will try to make further explanation of URL Filtering.

1. Overview

URL Filtering should provide a safe way to filter data via human-friendly URLs.

The main goal of this article is to explain an easy URL interface for filtering data. It allows the user to safely filter.

It is also needed to enable one field to have multiple filter parameters.

2. Operators

In the following rows, we will be describing different types of operators: Value Operator, String Operator, Numeric Operator, Range Operator.

Value Operators:

  • isnull - Is Null
  • isnotnull - Is not Null
  • isempty - Is Empty
  • isnotempty - Is not Empty

String Operators:

  • eq - Is Equal To
  • neq - Not Equals To
  • startswith - Starts With
  • contains - Contains
  • endswith - Ends With
  • doesnotcontain - Does Not Contain

Numeric Operators:

  • eq - Is Equal To
  • neq - Not Equals To
  • lt - Less Than
  • lte - Less Than or Equal
  • gte - Greater Than or Equal
  • gt - Greater Than

Range Operators

  • in - In array of values
  • notin - Not In array of values
  • between - Between values
  • notbetween - Not Between values

Example:

For example, the following will retrieve all items where:

  • id is 5:
    eq(id) = 5 or id = 5
  • and title contains John:
    contains(title)=John
  • and title does not contain Doe:
    doesnotcontain(title)=Doe
  • and status is in [active, pending]:
    in(status)=active,pending
  • and parent is not null:
    isnotnull(parent)=true

Example URL:

example.com/listview/?id=5&contains(title)=John&doesnotcontain(title)=Doe&in(status)=active,pending&isnotnull(parent)=true