lt & gt & lte & gte: Search Examples

The search operations lt & gt & lte & gte will search for entities where the search attribute value is greater than or lesser than the specified numerical value.

lt & gt & lte & gte should only be used to search for numerical type fields of integer or decimal

Example 1: Search for entities with value greater than value

Search:

  • Use the search API: Device Search
  • Match the attribute sub_type with the value greater than 25
  • Limit the number of results to 10 per page
  • Return the first page

Filter object will look like this:

{
  "filter": {   
    "sub_type": {
      "gt": 25
    }
  },
  "limit": 10,
  "page": 0
}

Encoded API call:

https://api.dev.example.biot-med.com/device/v2/devices?searchRequest=%7B%0A%20%20%22filter%22%3A%20%7B%20%20%20%0A%20%20%20%20%22sub_type%22%3A%20%7B%0A%20%20%20%20%20%20%22gt%22%3A%2025%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22limit%22%3A%2010%2C%0A%20%20%22page%22%3A%200%0A%7D

Example 2: Search for entities with value lesser than value

Search:

  • Use the search API: Device Search
  • Match the attribute sub_type with the value greater than 35
  • Limit the number of results to 10 per page
  • Return the first page

Filter object will look like this:

{
  "filter": {   
    "sub_type": {
      "lt": 35
    }
  },
  "limit": 10,
  "page": 0
}

Encoded API call:

https://api.dev.example.biot-med.com/device/v2/devices?searchRequest=%7B%0A%20%20%22filter%22%3A%20%7B%20%20%20%0A%20%20%20%20%22sub_type%22%3A%20%7B%0A%20%20%20%20%20%20%22lt%22%3A%2035%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22limit%22%3A%2010%2C%0A%20%20%22page%22%3A%200%0A%7D

Example 3: Search for entities with value between values

Search:

  • Use the search API: Device Search
  • Match the attribute sub_type with the value greater than or equals 30 and lesser than 35
  • Limit the number of results to 10 per page
  • Return the first page

Filter object will look like this:

{
  "filter": {   
    "sub_type": {
      "gte": 30,
      "lt": 35
    }
  },
  "limit": 10,
  "page": 0
}

Encoded API call:

https://api.dev.example.biot-med.com/device/v2/devices?searchRequest=%7B%0A%20%20%22filter%22%3A%20%7B%20%20%20%0A%20%20%20%20%22sub_type%22%3A%20%7B%0A%20%20%20%20%20%20%22gte%22%3A%2030%2C%0A%20%20%20%20%20%20%22lt%22%3A%2035%0A%20%20%20%20%7D%0A%20%20%7D%2C%0A%20%20%22limit%22%3A%2010%2C%0A%20%20%22page%22%3A%200%0A%7D