The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Rest V2 API returns wrong ID for attachment

Daniel Wendler
February 10, 2025

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]+

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

 

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..

 

 

1 answer

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Answer accepted
Daniel Wendler
February 18, 2025

Getting the `AttachmentSingle` API response object

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}

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events