Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Duplicate comments returned when paginating footer comments API with sort=-created-date

Mohan Kanawade October 6, 2025

We have a Confluence Forge app with custom UI.

We are facing an issue when fetching paginated comments for pages and blog posts using the following APIs:

  • For pages: /wiki/api/v2/pages/{pageId}/footer-comments?sort=-created-date&limit=10&body-format=atlas_doc_format
  • For blog posts: /wiki/api/v2/blogposts/{blogPostId}/footer-comments?sort=-created-date&limit=10&body-format=atlas_doc_format

Use case:
We need to display the latest 10 comments initially and then fetch more comments on demand using the _links.next URL.

Problem:
Pagination works correctly for the first two pages, but from page 3 onward, duplicate comment IDs reappear from earlier pages (e.g., comments from page 1 show up again). As a result, some comments are duplicated while others are missing.

Example (assuming 50 comments with IDs 1–50):

  • Page 1 → IDs 41–50 (correct)
  • Page 2 → IDs 31–40 (correct)
  • Page 3 → mix of IDs 21–30 and some IDs from 41–50 (incorrect – duplicates from page 1)

This issue only occurs when we add sort=-created-date. If we omit sort and just use limit=10&body-format=atlas_doc_format, the pagination works as expected.

Questions:

  1. Is this a known issue with the comments API when using sort=-created-date?
  2. Am I misusing the API, or is there an alternate approach to achieve correct descending pagination of comments without duplicates?

1 answer

3 votes
Jayesh
Contributor
October 6, 2025

Hello @Mohan Kanawade 

Yes similar issues are reported when paginating with sort parameters  escpecially reverse sorting.

 

Below is an alernate approach which might help

  • Use curson-based pagination carefully specially _links.next
  • Implement filtering or timestamp based pagination
  • Omit sorting without created-date

Thanks
Jayesh R

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events