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?
Hi @Peter Kapteyn and welcome to the community,
You can use this endpoint:
GET /attachments
which you can sort by modified date:
sortAttachmentSortOrder
Used to sort the result by a particular field.
Valid values:
created-date
,-created-date
,modified-date
,-modified-date
https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-attachment/#api-attachments-get
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.