REST API returns misleading 409 error instructing callers to update trashed page title before restore

XMLWordPrintable

    • 1
    • Severity 3 - Minor

      Issue Summary

      When attempting to restore a trashed page via the Confluence REST API when a title collision exists in the space, the API returns a `409 Conflict` containing an instruction that cannot be performed via the REST API.

      Steps to Reproduce

      1.  In any Confluence space, create a page named `Alpha` and delete/trash it.
      2. Create a new, different page in the same space named `Alpha`.
      3. Attempt to restore the first page via REST API v1:  `PUT /wiki/rest/api/content/{trashedId}` with payload `{"status": "current", "version": {"number": 2}}`
      4. Observe the returned 409 error message. 
      5. Attempt to follow the 409 message's instruction by updating the trashed page's title:  `PUT /wiki/rest/api/content/{trashedId}?status=trashed` with payload `{"status": "trashed", "title": "Alpha (Renamed)"}`

      Expected Results

      The error message should accurately reflect API capabilities (e.g., stating that a live page with that title exists and that title updates to trashed entities are not supported via REST).

      Actual Results

      • Step 3 (Restore attempt): Returns `409 Conflict`:
        • > "Cannot restore content with id ContentId{id=...}: newer Content exists in space KEY with title Alpha. You must either remove that new content, or update the title of the trashed content before restoring it." 
      • Step 5 (Following the 409 instruction):** Returns `404 Not Found` (v1) or `400 Bad Request` (v2): 
        • >"Trashed content cannot be updated, you need to restore it first by setting its status to current."* The caller is trapped in a contradictory loop where each error instructs them to perform the other action first.

      Suggestion: Update the legacy server-side 409 validation message to remove the reference to updating the title of trashed content via API, or clarify that renaming trashed content is only supported via the Web UI trash restore dialog.

      Workaround

      Follow the workaround of temporarily renaming the live conflicting page prior to executing the restore call.

              Assignee:
              Benjamin Wang
              Reporter:
              Shubham Khanna
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated: