From fbfc1266c5aa9d95a6d4c77da2cf52bb2ac13116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Barrado=20Gonz=C3=A1lez?= Date: Mon, 5 Feb 2024 12:47:20 +0100 Subject: [PATCH 1/2] Added filter criteria related Issue 103 Updated desing guidelines related filtering discussed in issue 103 --- documentation/API-design-guidelines.md | 28 +++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/documentation/API-design-guidelines.md b/documentation/API-design-guidelines.md index f2390e65..42def90f 100644 --- a/documentation/API-design-guidelines.md +++ b/documentation/API-design-guidelines.md @@ -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**: From 6975f4ece3cd043d7d6041ace90e7f8bb4be88b9 Mon Sep 17 00:00:00 2001 From: Rafal Artych <121048129+rartych@users.noreply.github.com> Date: Tue, 6 Feb 2024 16:32:59 +0100 Subject: [PATCH 2/2] Update API-design-guidelines.md --- documentation/API-design-guidelines.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/documentation/API-design-guidelines.md b/documentation/API-design-guidelines.md index 42def90f..d2e44976 100644 --- a/documentation/API-design-guidelines.md +++ b/documentation/API-design-guidelines.md @@ -734,10 +734,10 @@ Next, it is specified how it should be used according to the filtering based on | **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` | +| Greater or equal | `GET .../?amount.gte=807.24` | `GET.../?executionDate.gte=2018-05-30` | +| Strictly greater | `GET .../?amount.gt=807.24` | `GET.../?executionDate.gt=2018-05-30` | +| smaller or equal | `GET .../?amount.lte=807.24` | `GET.../?executionDate.lte=2018-05-30` | +| Strictly smaller | `GET .../?amount.lt=807.24` | `GET.../?executionDate.lt=2018-05-30` | And according to the filtering based on string and enums data being searched for: