You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The total field in the response should consistently represent the total number of items available for a given content type, independent of the current page, limit, or items returned. This would provide a reliable metadata value for pagination logic.
Actual Behavior
When fetching entries for a specific content type, the total field changes depending on the current page and limit.
For example:
On ?page=1 with limit=6:
Blog posts: The response contains 6 items with a total of 6.
Events: The response contains 6 items with a total of 7.
This works as expected.
On ?page=2 with limit=6:
Blog posts: The response contains an empty array and a total of 0, even though there are still 6 blog posts in total. This is inconsistent and misleading because the total value should always represent the total number of blog posts.
Events: The response contains 1 item and a total of 7, which is correct and consistent.
Possible Solution
Ensure the total field consistently represents the total count of entries for a given content type, regardless of the current page or limit.
Steps to Reproduce
Set up an API endpoint that returns paginated entries for blog posts and events.
Add 6 blog posts and 7 events to the system.
Request ?page=1 with a limit of 6:
Blog posts: Returns 6 entries and total: 6.
Events: Returns 6 entries and total: 7.
Request ?page=2 with the same limit:
Blog posts: Returns an empty array and total: 0.
Events: Returns 1 entry and total: 7.
Simpler setup
Set up an API endpoint that returns paginated entries
Add 1 entry
Request all entries with getEntries, limit=1, skip=0
One entry will be returned, total will be 1
Request all entries limit=1, skip=1
no items returned, total is 0
Context
The inconsistent behaviour of the total field complicates pagination logic, especially when listing multiple content types (e.g., blog posts and events) on a single page. It forces additional API calls or complex workarounds to calculate accurate totals for each content type. A reliable total field or an alternate metadata endpoint would simplify this significantly.
The text was updated successfully, but these errors were encountered:
Expected Behavior
The
total
field in the response should consistently represent the total number of items available for a given content type, independent of the currentpage
,limit
, oritems
returned. This would provide a reliable metadata value for pagination logic.Actual Behavior
When fetching entries for a specific content type, the total field changes depending on the current page and limit.
For example:
On
?page=1
withlimit=6
:On
?page=2
withlimit=6
:Possible Solution
Ensure the total field consistently represents the total count of entries for a given content type, regardless of the current page or limit.
Steps to Reproduce
Set up an API endpoint that returns paginated entries for blog posts and events.
?page=1
with a limit of 6:?page=2
with the same limit:Simpler setup
Set up an API endpoint that returns paginated entries
total
will be 1total
is 0Context
The inconsistent behaviour of the
total
field complicates pagination logic, especially when listing multiple content types (e.g., blog posts and events) on a single page. It forces additional API calls or complex workarounds to calculate accurate totals for each content type. A reliable total field or an alternate metadata endpoint would simplify this significantly.The text was updated successfully, but these errors were encountered: