Jonathan Sinovassin-Naïk created UNOMI-870:
----------------------------------------------
Summary: Improve rest endpoints
Key: UNOMI-870
URL: https://issues.apache.org/jira/browse/UNOMI-870
Project: Apache Unomi
Issue Type: Bug
Reporter: Jonathan Sinovassin-Naïk
h2. Important note:
The modifications for this ticket will introduce breaking changes. Some REST
endpoints will not have the same signature.
h2. Summary:
Implement pagination, sorting, and a response wrapper for the GET / REST
endpoint to improve performance and scalability. For example for /rules,
/scopes, /segments...
Standardization of the behaviour for each endpoints.
The current implementation of the GET /scopes endpoint returns all Scope
objects without any limitation, same for the rules.
The segment endpoint does not returns a pageable result. So it's not possible
to have the number of existing result.
h2. Description
The goal is to optimize the service by introducing:
Pagination: Limit the number of results returned per request.
Sorting: Allow clients to specify the order of results
Wrapper: Return the data in a structured format, including metadata (e.g.,
total items, current page).
Add query parameters to the request:
page: The page number requested (default: 0).
size: The number of items per page (default: 50).
sort: Sorting criteria with order
The return results should be wrapped into ant object containing the list detail
Example:
{code:java}
{
"items": [
{ "id": 1, "name": "Scope1" },
{ "id": 2, "name": "Scope2" }
],
"totalCount": 100,
"currentPage": 0,
"pageSize": 25
}
{code}
h2. Tech notes:
For sorting data, execute an Elasticsearch query might be faster than reading
the data in memory.
Ensure that the data in memory are the same that the data returned by the
endpoint
--
This message was sent by Atlassian Jira
(v8.20.10#820010)