how to sort the attachments using confluence rest API

Sundar sarma March 30, 2023

I am using confluence API to get attachments. i would like to sort the attachments based on the attachment name, by date, and by size.

I am using the below rest API to get attachments.

confluence/rest/api/content/{pageid}/child/attachment?limit=25&start=0&expand=history

 

2 answers

0 votes
Sundar sarma March 30, 2023

In confluence itself there is sort by title, sorty size and sorty by creation date right.

you can observe the below screenshot.

i have to sort by filesize, title and created date as well

referring below rest api documentation

https://docs.atlassian.com/ConfluenceServer/rest/6.12.1/ - confluence rest api

 

cap1.PNG

0 votes
Peter Van de Voorde
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 30, 2023

Hi @Sundar sarma ,

Seems like you're using the old deprecated Confluence REST API.

I would recommend you to use the following endpoint: https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-attachment/#api-pages-id-attachments-get

But you can't sort by name, only by different relevant dates.

I hope this helps.

Cheers,
Peter

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events