This issue has been created
 
 
XWiki Platform / cid:jira-generated-image-avatar-0a830d58-fb69-4a71-8d52-066b9fbb4fd4 XWIKI-22660 Open

Make it possible to get the metadata of a single attachment from the REST endpoints

 
View issue   ยท   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-11348007-c910-420f-8745-f1e69c1d6f1a Manuel Leduc created this issue on 14/Nov/24 17:11
 
Summary: Make it possible to get the metadata of a single attachment from the REST endpoints
Issue Type: cid:jira-generated-image-avatar-0a830d58-fb69-4a71-8d52-066b9fbb4fd4 Improvement
Affects Versions: 16.9.0
Assignee: Unassigned
Components: REST
Created: 14/Nov/24 17:11
Priority: cid:jira-generated-image-static-major-4cc23781-bd33-488c-98c2-65d80d5154ec Major
Reporter: Manuel Leduc
Description:

Calling .../attachments returns array of attachments metadata like the json below. But, when calling .../attachments/{fileName}, the response is not a json object, but the file binary content and the mimetype.
As a REST client, one needs to fully download the file, which is not optimal, and re-compute all the of the metadata that one could get from the server, which is not optimal either.
The only other option is to call the .../attachments REST endpoint. But this is not optimal either as the list of attachments is not paginated and cannot be filtered.

{
  "id": "xwiki:Sandbox.WebHome@xwikilogo_400x400.png",
  "name": "xwikilogo_400x400.png",
  "size": 79470,
  "longSize": 79470,
  "version": "1.1",
  "pageId": "xwiki:Sandbox.WebHome",
  "pageVersion": "39.1",
  "mimeType": "image/png",
  "author": "XWiki.Admin",
  "authorName": null,
  "date": 1731428868000,
  "xwikiRelativeUrl": "http://localhost:15680/xwiki/bin/download/Sandbox/WebHome/xwikilogo_400x400.png?rev=1.1",
  "xwikiAbsoluteUrl": "http://localhost:15680/xwiki/bin/download/Sandbox/WebHome/xwikilogo_400x400.png?rev=1.1"
}