Previously attachments could be loaded in the backend using AttachmentLoader#loadAttachment(). But it has been deprecated and com.mgmtp.a12.dataservices.attachment.v2.AttachmentService should be used as a replacement according to the deprecation information.
I’ve searched for a way to access the content of the attachments directly in the backend and I did not find a satisfying solution (this really basic use case is not mentioned in the documentation):
-
com.mgmtp.a12.dataservices.attachment.v2.AttachmentServiceonly provides a download url via#getAttachmentUrl(). Calling this url seems highly inefficient for accessing the files internally in the backend. -
I could try to use
com.mgmtp.a12.contentstore.service.ContentStoreService, but even there I would need to first create a download url, extract the download id from it and callContentStoreService#getContent()with it. -
Calling
com.mgmtp.a12.contentstore.content.internal.ContentService#getByContentIdAndPersistentType()directly may be a solution, but this is marked as internal, so probably not the intended way
So what is the intended way to access the attachments?