Demo application using RSQL parser to filter records based on provided condition(s)
A Single GET API
is all that is needed to be exposed per Entity class.
- UUID
- LocalDate
- LocalDateTime
- Enum
- Boolean String (true, false) and Bit (1,0)
- Nested Objects
- equalIgnoreCase (=eic=)
- notEqualIgnoreCase (=neic=)
RSQL-Sample-Examples.mov
-
Pagination
- Query parameters to include
count
: maximum elements to be returned in a pagepage
: starts with 1, if value provided is <=0, first page is returned and if value>totalPages, the last page is returned
- Sample path
http:localhost:8080/wizards?query=gender==female&count=5&page=1
- Sample Response
{ "currentPage": 1, "totalPages": 2, "count": 5, "result": [ { "id": 2, "fullName": "Hermione Granger", "species": "HUMAN", "gender": "FEMALE", "house": { "id": 1, "name": "Gryffindor" }, "dateOfBirth": "1979-09-19", "eyeColor": "brown", "hairColor": "brown", "wand": { "id": 2, "wood": "vine", "core": "dragon heartstring", "length": null }, "patronus": null, "isProfessor": false, "alive": true, "imageUrl": "http://hp-api.herokuapp.com/images/hermione.jpeg" } ... and 4 more ] }
- Query parameters to include
-
Sorting
-
Query parameter to be included
sort
-
Operators
- Ascending:
@
- Descending:
$
- Ascending:
-
Examples:
- to sort with fullName descending
&sort="$descending"
- to sort with dateOfBirth ascending
&sort="@dateOfBirth"
- to sort with ascending dateOfBirth and fullname descending
&sort="@dateOfBirth$fullname"
-
- HttpStatus.PRECONDITION_FAILED (412) thrown when SQL Injection attack is attempted
- Library Used in RsqlSpecification.java
SQL-Injection-prevention-rsql.mov
⭐️ Star the repository to show support
🤝 PRs welcome