Hi all,
The aim is to retrieve values from the Conf Cloud REST API and display the values in a paginated table (If there are thousands of results, it is not feasible to get all results when only displaying 1 page).
The 2 examples I have are retrieving Groups and Retrieving Users:
Users (Rest API Docs)
/wiki/rest/api/search?cql=type=user and user.fullname~<USERQUERY>&start=<START>&limit=<LIMIT>
This returns Json results, along with start
, limit
, size
and totalSize
.
The problem is totalSize
ignores not retrieved values, and is exactly the same as size
.
e.g.
/wiki/rest/api/search?cql=type=user and user.fullname~denny&start=0&limit=5
This shows 3 users, and as the limit was 5, all 3 users are returned.
However:
/wiki/rest/api/search?cql=type=user and user.fullname~denny &start=0&limit=2
Returns only 2 users for totalSize
.
This means the true ‘total’ is not returned unless i loop through the max limit
, each time counting the totalSize
until totalSize < limit
(No more results would be found).
This cannot be the most efficient method to retrieve all results?
Groups (Rest API Docs)
/wiki/rest/api/group/picker?query=<GROUP>&start=<START>&limit=<LIMIT>
This returns Json results, along with start
, limit
and size
(If limit is reached, size and limit will be equal, otherwise size < limit as expected). Unlike the user retrieval, there is no totalSize
.
TL:DR
When rendering results into Atlaskit DynamicTable, all rows are required. (Not feasible when there may be many thousands of results).
Because of this, I intend to render only the current page. This however requires knowing the total number of results for the pagination buttons (Page 1, Page 2 etc). Is there any way to achieve this at present that does not include looping through API calls, increasing start
and limit
until I have calculated the actual totalSize value?