The Atlassian API is returning data like this from the wiki endpoint `/wiki/api/v2/pages/<id>`
{"type":"media","attrs":{"width":1278,"alt":"alt text","id":"51013016-44a8-438f-b0b7-fb619714df9a","collection":"contentId-1180220222","type":"file","height":1500}},
The ID is not requestable from the endpoint `/wiki/api/v2/attachments/<id>`, the format is not UUID but pattern (att)?[0-8]+
How do I cirumvent this mapping issue?
How do I request the media attachments via the ID in UUIDv4 formt?
There is already an issue up here that mine duplicates, without an answer.
This is very related to the following issue from 2022, but there are only workarounds no solutions..
The endpoint `/wiki/api/v2/attachments/{id}` is broken and doesn't return data, no matter if we use UUIDv4, prefixed, or non-prefixed content-ID.
Instead, I'm using the endpoint `/wiki/api/v2/attachments`, with parameters `limit` => `1` and `filename` => `.attrs.alt`.
The `.downloadLink` property in the resulting ADF works and could also be built manually:
Use the fields `.attrs.alt` as `$filename`, and from the field `.attrs.collection`, strip the prefix (`([a-zA-Z]+-)`) as `$contentId`:
https://<atlassian-host>/wiki/download/attachments/{$contentId}/{$filename}
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.