Skip to content

GET request URL parameters

loveyourstack edited this page Mar 11, 2026 · 10 revisions

This page shows the default URL parameters available when using the generic lys.Get and lyspg.Select functions to select data from a table or view.

Filtering

Filtering is done by specifying the column name, an operator and a value, for example: &name=Fruit.

These values are parsed and converted to database WHERE clauses.

Operators

The following operators are available:

Name Example
Equals &name=Fruit
Not equals &name=!Fruit
Starts with &name=Fr~
Ends with &name=~uit
Contains &name=~rui~
Not contains &name=!~rui~
Empty &name={empty}
Not empty &name={!empty}
Null &name={null}
Not null &name={!null}
In &name=Fruit|Veg
Not in &name=!Fruit|Veg
Contains any &name=~[uit|eg]~
Greater than &price=>10
Greater than or equals &price=>eq10
Less than &price=<10
Less than or equals &price=<eq10

Paging

Page selection is done as follows: &xpage=1. If this URL key is omitted, page 1 is returned.

Number of records per page is done as follows: &xper_page=20. If this URL key is omitted, 20 records are returned.

There is a default maximum value of 500 for the xper_page parameter to prevent the API user from requesting an excessive number of records.

These are converted to LIMIT and OFFSET clauses.

Sorting

Sorting is done by passing column names as follows: &xsort=name,-price

Adding "-" before the column name results in a descending sort.

This is converted to an ORDER BY clause.

Field selection

Return only listed fields as follows: &xfields=id,name

Return all fields except those listed: &xfields=-id,name

If this URL key is omitted, all fields are returned.

Overriding default values

The default GET options are defined by the lys.FillGetOptions function in options.go. You can override them by defining your own lys.GetOptions in the lys.Env struct, and passing this to your lys.Get functions.

Clone this wiki locally