We are experiencing an issue with the copy single page API. Our code used to work, but Atlassian must have changed something on their side that broke it.
We make two POST requests against /rest/api/content/{id}/copy
.
Request 1: We’re copying source page 1, putting it under an existing parent page, and supplying a modified body. The referenced attachment does not yet exist. It will be copied in the second call.
POST /rest/api/content/{source-page-1-id}/copy
{
"copyAttachments": true,
"copyPermissions": false,
"copyProperties": false,
"copyLabels": true,
"copyCustomContents": false,
"destination": {
"type": "parent_page",
"value": "{parent-page-id}"
},
"pageTitle": "Target Page",
"body": {
"storage": {
"representation": "storage",
"value": "<ac:image><ri:attachment ri:filename=\"image.jpg\" ri:version-at-save=\"1\" /></ac:image>"
}
}
}
Request 2: We’re copying source page 2 to the existing target page, again supplying a modified body. Source page 2 contains the referenced attachment.
POST /rest/api/content/{source-page-2-id}/copy
{
"copyAttachments": true,
"copyPermissions": false,
"copyProperties": false,
"copyLabels": false,
"copyCustomContents": false,
"destination": {
"type": "existing_page",
"value": "<target-page-id>"
},
"pageTitle": "Target Page",
"body": {
"storage": {
"representation": "storage",
"value": "<ac:image><ri:attachment ri:filename=\"image.jpg\" ri:version-at-save=\"1\" /></ac:image>"
}
}
}
Everything seems to work: the attachment is there, the storage format looks right, the image even shows up in the export view (e.g. in PDF exports). However, the Confluence page view in the browser refuses to show the image. Instead it shows a gray placeholder box.