Hello!
I'm developing a script to help us in a content migration.
The goal is :
-list all pages in a space,
-for each page, list all attachment
-for each attachment, find out the filename in a table and (if found) add a comment to the attachment (extracted from the external table).
I'm facing problems with the last step, I can get all attachments in a page by calling:
GET /rest/api/content/%pageID%/child/attachment
returns an array of 2 attachments (ok).
each attachment contains id, filename, metadata (Versions, author ..etc). Attachment ID format is "att16257549" (??)
I'm trying PUT /content/%pageID%/child/attachment/%attachmentId%
But seems like the attachment ID is not the same format as the previous step.
How can I add the comment to the attachment?
----- EDIT ----
in order to clarify the example
Im sending a PUT /content/%pageID%/child/attachment/att16259572
with this payload:
{"id":"att16259572","type":"attachment","status":"current","title":"Path LUN is dead.doc","ancestors":[],"operations":[],"children":[],"descendants":[],"body":[],"restrictions":[],"metadata":{"comment":"Path LUN is dead"}}getting HTTP 400.
(and other variations, but the goal is only updating the attachment comment.)