Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added filter criteria related Issue 103 #132

Merged
merged 3 commits into from
Feb 9, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions documentation/API-design-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -729,16 +729,24 @@ https://api.mycompany.com/v1/orders?orderBy=rating,reviews,name&order=desc

Filtering consists of restricting the number of resources queried by specifying some attributes and their expected values. It is possible to filter a collection on multiple attributes at the same time and allow multiple values for a filtered attribute.

Next, it is specified how it should be used according to the filtering based on the type of data being searched for: a text, a number or a date and the type of operation.

| **Operation** | Text | Numbers | Dates |
| ----- | ----- | ----- | ----- |
| Equal | `GET .../?name=Juan` | `GET .../?amount=807.24` | `GET .../?executionDate=2018-30-05` |
| Greater or equal | N/A | `GET .../?amount.gte=807.24` | `GET.../?executionDate.gte=2018-30-05` |
| Strictly greater | N/A | `GET .../?amount.gt=807.24` | `GET.../?executionDate.gt=2018-30-05` |
| smaller or equal | N/A | `GET .../?amount.lte=807.24` | `GET.../?executionDate.lte=2018-30-05` |
| Strictly smaller | N/A | `GET .../?amount.lt=807.24` | `GET.../?executionDate.lt=2018-30-05` |
|Contains | `GET .../?name=~Juan` |N/A | N/A |
Next, it is specified how it should be used according to the filtering based on the type of data being searched for: a number or a date and the type of operation.

| **Operation** | Numbers | Dates |
| ----- | ----- | ----- |
| Equal | `GET .../?amount=807.24` | `GET .../?executionDate=2024-02-05T09:38:24Z` |
| Greater or equal | `GET .../?amount.gte=807.24` | `GET.../?executionDate.gte=2018-30-05` |
| Strictly greater | `GET .../?amount.gt=807.24` | `GET.../?executionDate.gt=2018-30-05` |
| smaller or equal | `GET .../?amount.lte=807.24` | `GET.../?executionDate.lte=2018-30-05` |
| Strictly smaller | `GET .../?amount.lt=807.24` | `GET.../?executionDate.lt=2018-30-05` |


And according to the filtering based on string and enums data being searched for:

| **Operation** | **Strings/enums** |
| ----- | ----- |
| equal | `GET .../?name=Juan` |
| non equal | `GET .../?name!=Jonh` |
| Contains | `GET .../?name=~Rafa` |


**Additional rules**:
Expand Down