Query API:

POST /query

The post body must contain a JSON string object named "query":

  {"query": "your query goes here..."}

Remember to use JSON.stringify:

  JSON.stringify({query: your_query, apply_limit_offset_to_sql: false})

You may also set "apply_limit_offset_to_sql" to true or false as shown:

  JSON.stringify({query: your_query, apply_limit_offset_to_sql: false})

Please keep in mind that by setting "apply_limit_offset_to_sql" to false you are
potentially going to incur a large performance hit as the [limit] and [offset]
query settings will be applied after the entire SQL result set is returned from
the database to the application server.

Query Syntax:

entity_name(fields)(filter)(sort)[limit][offset]

Requirements:

entity_name and (fields) are required.

(filter) is optional

(sort) is optional.
If (sort) is included, then (filter) must be included.
An empty "(filter)" is allowed: "()".

[limit] is optional
If [limit] is included then (sort) must also be included.
An empty "(sort)" is allowed: "()".

[offset] is optional.
If [offset] is included then [limit] must also be included.
An empty [limit] is not allowed.

Comments:

/*this is a multi-line
comment*<ml_remove>/

--this is a single line comment.

(fields) Syntax:

(field1, field2, field3, ...)

Any given field can also be a sub-entity:

  (field1, sub-entity_name(fields)(filter), field3, ...)

Sub-entities follow the same rules as entities except that (sort), [limit], and [offset] are not allowed.
Except that sub-entities may have a trailing "@" attached to their name in which case, the query treats
the relationship similar to a "left join" in SQL.

(filter) Syntax:

(field operator value connector field operator value connector...)

(field1 == value and (field2 < value or field2 > value))

strings and date values should be in single quotes.

numeric values should not be in quotes.

Example:

  (id > 10 and id < 1000 and my_date == '2015-08-27' and name == 'abc')

Valid operators:

  "=="  (equal to)
  "!="  (not equal to)
  ">"   (greater than)
  "<"   (less than)
  ">="  (greater than or equal to)
  "<="  (less than or equal to)
  "~"   (like) Note: You can embed % as in standard sql. Example: "%text%"
  "=~"  (regular expression) Note: Not yet implemented.  Example: "/regexp/"
  "~~"  (full text search) Note: Not yet implemented.    Example: "full text search query"
  ">>"  (in) Example: id >> (1, 2, 3)
  "<<"  (not in) Example: name << ("Tom", "Steve")
  "is"  (is null) Example: name is null
  "is!" (is not null) Example: name is! null

Valid connectors:

  "and"
  "or"

Grouping:

  "(" and ")" can be used for grouping.

(sort) Syntax:

(field1, field2, ...)
(field1 asc, field2 desc, ...)
(field1, sub-entity_name.field2, ...)

You cannot include the entity_name in sorts, but sub-entity names are required as qualifiers for their field names.
limit

Syntax:

integer

Example:

[10]
offset

Syntax:

integer

Example:

[10]

Full Query Examples:

1:

user(id, name, first_name, last_name, user_name, email, phone, hash, active)

2:

siebel_user(

siebel_id,
user_name,
password

)