Singularity icon indicating copy to clipboard operation
Singularity copied to clipboard

API requests for pageable data should include property in response indicating additional data available

Open benheng opened this issue 7 years ago • 2 comments
trafficstars

Related to HubSpot/Singularity/pull/1706

In the above PR, the front-end is making two API requests to manually check if there exists at least 1 more item after the page, then it requests the items for the current page. It would be a lot cleaner if the back-end just returned this status as part of the response object. It doesn't even have to contain the total count, as that may have some performance implications. Just that there is at least 1 more item after the current page.

benheng avatar Feb 26 '18 18:02 benheng

We have endpoints for some of these already (ones ending in withmetadata) that return a page and count along with the data. Unfortunately we've found the counting to be rather slow in SQL, so we'll likely need to find a way to speed it up before they are viable for regular use

ssalinas avatar Feb 28 '18 14:02 ssalinas

Is it feasible to ask for n + 1 objects when issuing the query? Then you don’t need a count per se

mikebell90 avatar Aug 03 '18 14:08 mikebell90