Forums

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

How to find out which is the most recently modified attachment using REST API?

Peter Kapteyn
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!
September 29, 2020

I'm using the REST API to download attachments from a confluence page. I'd like to find out which one was been modified or uploaded most recently. 

I'm using this to download as of now:

https://mydomain.net/wiki/rest/api/content/12345/attachment

This gives me the data that looks like this:

"id":"att1356398593",
"type":"attachment",
"status":"current",
"title":"myFile.bin",
"macroRenderedOutput":{

},
"metadata":{
"mediaType":"application/octet-stream"
},
"extensions":{
"mediaType":"application/octet-stream",
"fileSize":...,
"comment":"",
"fileId":"FIELD_NUM"
},
"_expandable":{
"childTypes":"",
"container":"/rest/api/content/...",
"operations":"",
"children":"/rest/api/content/.../child",
"restrictions":"/rest/api/content/.../restriction/byOperation",
"history":"/rest/api/content/.../history",
"ancestors":"",
"body":"",
"version":"",
"descendants":"/rest/api/content/.../descendant",
"space":"/rest/api/space/..."
},
"_links":{
"webui":"...",
"self":"...",
"download":"..."
}

 

Is there anything here that I can parse to get date modified? Or should a use a different API request?

1 answer

0 votes
Alex Koxaras _Relational_
Community Champion
July 26, 2024

Hi @Peter Kapteyn and welcome to the community,

You can use this endpoint:

GET /attachments

which you can sort by modified date:

sort

AttachmentSortOrder

Used to sort the result by a particular field.

Valid values: created-date-created-datemodified-date-modified-date

https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-attachment/#api-attachments-get

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events