Developers

Using IQL

IQL stands for Inbenta Query Language. It allows you to perform complex requests that would otherwise be difficult or even impossible with simple parameters in the Benti API.

 
Note

the use of the iql disallow the use of the other parameters to avoid conflict between them. For example "iql": "queue IS 2" could have conflict with the query string queue. Only the pagination parameters can be use at the same time than iql.

Syntax

Raw comparison

Operator Negate Description Example
IS IS NOT Makes sure the field has a value equal to the one provided director IS "Steven Spielberg"
IS EMPTY IS NOT EMPTY

Makes sure the field has a value of either:

  • 0 elements (if it is an array),
  • 0 characters (if it is a string),
  • is 0 (if it is an integer), or
  • is null
director is EMPTY

Numerical comparison

Operator Negate Description Example
> - Makes sure the field has a value that is greater than the given number movie.score > 3
< -

Makes sure the field has a value that is less than the given number

movie.score < 5
>= -

Makes sure the field has a value that is equal to or greater than the given number

movie.score >= 3
<= -

Makes sure the field has a value that is equal to or less than the given number

movie.score <= 5

Logic operators

Operator Negate Description Example
AND - makes sure that two conditions are met director IS "Steven Spielberg" AND movie is "Jurassic Park"
OR -

Makes sure at least one of the two conditions is met

director IS "Steven Spielberg" OR director is "Martin Scorsese"

Others

Operator Negate Description Example
(, ) - Evaluates the content of the parentheses individually director is "Martin Scorsese" OR (director IS "Steven Spielberg" AND movie is "Jurassic Park")

Operands

  • text: Text operands should be wrapped between quotes. i.e: "some text"
  • numbers: Numbers can be used directly.
  • variables: Variables are references to fields and should be written without quotes i.e: some_variable

See the example below to view these operands in action.

Allowed Variables

  • parent: parent ticket id (when you search for subtickets).
  • queue: the queue id.
  • solver: the user id in charge of the ticket.
  • creator: the user id that created the ticket.
  • created: the creation date of the ticket (in YYYYMMDDHHMMSS format).
  • archived_at: the last archiving date of the ticket (in YYYYMMDDHHMMSS format).
  • priority: the ticket priority id.
  • title: the ticket title.
  • language: the ticket language id.
  • source: the ticket source id.
  • external_id: the ticket external_id id, usually a social media id or a HyperChat id.
  • status: the ticket status id.
  • label: the ticket substatus id.
  • last_change: the date the ticket was last modified (in YYYYMMDDHHMMSS format).
  • extra.[name]: the extra data value of the type [name].

Use Case

IQL can be used in:

  • [GET] /tickets
  • [GET] /tickets-search

Example

  • To find all the tickets created after a certain time (written in format YYYYMMDDHHMMSS) that contain the email "example@inbenta.com" as the value for the ticket extra data field "email":
    created > 20191214113245 AND extra.email IS "example@inbenta.com"
  • To find all the tickets that were last modified in the week from 10 May 2020 to 16 May 2020:
    last_change > 20200510000000 AND last_change < 20200516235959