-
Bug
-
Resolution: Fixed
-
High
-
30
-
Severity 3 - Minor
-
4
-
Issue Summary
When using Confluence's REST API to copy pages, it won't be possible to publish edits to them.
It's happening to either single pages or to pages copied in bulk using the /rest/api/content/PAGE_ID/copy endpoint.
Steps to Reproduce
- create some pages in the new editor
- use the copy page api to copy the pages to another space
- Try to edit and publish some of the copies
Expected Results
It should be possible to publish edits to the copies
Actual Results
The following error is shown:
This content cannot be accessed.
Your session may have expired. You'll need to log in again or switch to another account to keep working.
Log in or switch to another account
The request responds with a 404:
Request URL: https://INSTANCE.atlassian.net/wiki/rest/api/content/PAGE_ID/?status=draft&action=publish Request Method: PUT Status Code: 404 Payload: { "id": "33687092", "type": "page", "title": "Page7", "space": { "key": "LSCA" }, "body": { "editor": { "value": "{\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Test page\"}]}],\"version\":1}", "representation": "atlas_doc_format", "content": { "id": "33687092" } } }, "status": "current", "version": { "number": 2, "message": "", "minorEdit": false, "syncRev": "0.1J5gwnHlridgfWJNgrBCmw.0" } } Response: { "statusCode": 404, "data": { "authorized": false, "valid": true, "errors": [], "successful": false }, "message": "com.atlassian.confluence.api.service.exceptions.NotFoundException: null" }
Notes
- This also happens when copying a single page using the same endpoint
Workaround
Option A:
- Edit the page
- Click on ••• and select View Changes
- Close the changes dialog and Publish the page
Option B:
- Create a new bookmark to any page in your browser.
- Edit the bookmark: change name to 'Fix page' (or any other suitable name) and change address to the following:
javascript:fetch('/wiki/rest/tinymce/1/content/' + /pages(\/[\w-]+)?\/(\d+)/g.exec(location.href)[2] + '/draft/diff').then(() => console.log('Page fixed')).catch(() => console.log('Error'));
- Save the bookmark. For convenience move it to some easily accessible place (for example Bookmarks Bar in Chrome).
- Navigate to the page that you can't edit and invoke the added bookmark. You should now be able to edit the page.
Option C:
- Navigate to the page that you can't edit and open Developer Tools (Chrome), Web Inspector (Safari) or the alternative in your browser.
- In the Developer Tools open Console.
- Paste the following code to the console and press Enter:
fetch('/wiki/rest/tinymce/1/content/' + /pages(\/[\w-]+)?\/(\d+)/g.exec(location.href)[2] + '/draft/diff').then(() => console.log('Page fixed')).catch(() => console.log('Error'));
- You should see the "Page fixed" message, and after that you should be able to edit the page.
- is related to
-
CONFCLOUD-71283 Body is not changed when copying page with API
- Closed