Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,557,404
Community Members
 
Community Events
184
Community Groups

How do a I get a list of all attachment versions using the Confluence Rest API?

Hi,

I'm trying to figure out how to get a list of all the versions of an attachment using the rest api.  In particular, the version number, date and time of each version.  I've tried variations on the rest api url, but haven't had much luck.  I'm probably making a simple mistake.

Things I've tried:

rest/api/content/<Attachment ID>/history

rest/api/content/<Page ID with attachments>/descendant?expand=attachment

rest/api/content/<Page ID with attachments>/child/attachment?expand=container,operations,children,restrictions,history,version,descendants,space

Thank you,

R

5 answers

0 votes
AzZureman
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
Feb 07, 2023 • edited

All attachments is also a representative of the "content" like a page.

So, endpoint GET /wiki/rest/api/content/{id}/version is also available for attachments.

For attachment with id att1769484 you can request

curl --request GET \
--url 'https://your-domain.atlassian.net/wiki/rest/api/content/att1769484/version' \
--user 'email@example.com:<api_token>' \ --header 'Accept: application/json'

 

I was able to do it using the solution described here: https://confluence.atlassian.com/confkb/how-to-retrieve-all-previous-versions-of-content-using-the-rest-api-1044789048.html

The URL to use is: /rest/experimental/content/{id}/version/

thats not working, also i need to list old versions to download and migrate to other platform. I tried all i saw

0 votes
Stephen Sifers
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
Sep 23, 2019

Hello R,

From reviewing your notes and the endpoints you’ve attempted, you should be able to get what you need from the last endpoint you listed. This endpoint should be able to provide what you’re looking for with the expands:

GET /rest/api/content/{id}/child/attachment

Example of what to use: http://example.com/confluence/rest/api/content/1234/child/attachment?filename=myfile.txt&expand=version

This should give your information in a format which will include version and when (this is the date).

Please let us know if this example is helpful in getting your attachment information.

Regards,
Stephen Sifers

but if the document has n versions for example 9 versions .. how can I list when each version was last updated.....or created....
I found 
https://xxxxxxxxx.atlassian.net/wiki/rest/api/content/xxxxxxxxxx/child/attachment?expand=history.lastUpdated,history.previousVersion&version=1

 

but just list the previous version of  the current one

Is this possible?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events