Querying the GO API

Querying the GO API

The GO API can be queried by passing a json-structure in the query-parameter of the URL such as https://server/endpoint/?query=JSON_STRUCTURE

The JSON structure can consist of query commands and logic commands.

Query commands

Query commands should contain three fields: type, fieldname and value

Type

Meaning

Type

Meaning

Greater

Return everything where fieldname is greater than value.

GreaterEqual

Return everything where fieldname is greater or equal than value.

Lesser

Return everything where fieldname is lesser than value.

LesserEqual

Return everything where fieldname is lesser or equal than value.

Like

Return everything where value is contained in fieldname.

Match

Return everything where fieldname equals value.

OneOf

Return everything where fieldname is one of value (value should be an array).

Logical commands

Logical commands contains a type and one or more conditions which are further query or logical commands.

Type

Additional fields

Meaning

Type

Additional fields

Meaning

AND

condition1, condition2

Return everything which satisfies both condition1 and condition2.

OR

condition1, condition2

Return everything which satisfies either condition1 or condition2.

NOT

condition

Return everything which doesn't satisfy condition.

Examples

Find all data where age is equal or greater than 18

{"type":"GreaterEqual","fieldname":"age","value":18}

 

Find all data where age is less than 40 and gender is male

 

{"type":"AND","condition1":{"type":"Lesser","fieldname":"age","value":40},"condition2":{"type":"Match","fieldname":"gender","value":"male"}}

 

Find all data where firstname contains the letter a

 

{"type":"Like","fieldname":"firstname","value":"a"}

 

Find all data changed since a specific time stamp

 

{"type":"Greater","fieldname":"change_date","value":"2021-01-15 14:45:00"}