For more detailed information refer to the Exposed Pagination Library.
Pagination allows optionally to combine multiple sorting fields with corresponding directions.
If a sort field does not have a direction, it will default to ASC
.
Syntax for sorting: ?sort=field1,direction1&sort=field2,direction2
Example: sort=firstName&sort=maritalStatus,desc&sort=email,asc
To avoid ambiguity when sorting by multiple fields sharing the same name across different tables,
the field name can be prefixed with the table name separated by a dot.
Example: sort=contact.email,desc
Some more examples:
- Page 0, 10 elements per page:
GET
http://localhost:8080/v1/employees?page=0&size=10
- Page 0, 10 elements per page, sorted by first name ascending:
GET
http://localhost:8080/v1/employees?page=0&size=10&sort=firstName,asc
- Page 0, 10 elements per page, sorted by first name ascending and marital status descending:
GET
http://localhost:8080/v1/employees?page=0&size=10&sort=firstName,asc&sort=maritalStatus,desc
- No pagination, sorted by first name, default to ascending:
GET
http://localhost:8080/v1/employees?sort=firstName
When filtering, all fields are optional. The supplied fields will construct an AND
filter.
For pagination and sorting, the same endpoint syntax as above can be used.
{
"firstName": "AnyName",
"lastName": "AnySurname",
"honorific": [
"MR",
"MISS"
],
"maritalStatus": [
"SINGLE",
"DIVORCED"
]
}
Searching will perform a partial match in a set of predefined fields. The query parameter is case-insensitive. The server is set to search in first name, last name, work email and contact email.