Uploaded image for project: 'Confluence Cloud'
  1. Confluence Cloud
  2. CONFCLOUD-73146

Updating pages via REST API using the "view" representation does not work

    XMLWordPrintable

Details

    Description

      Issue Summary

      When using the REST API to update a page, if it has the View representation under the body's value, the update will not work.

      Although it will provide a "200" response, no changes will be done to the page nor a new version will be created.

      Steps to Reproduce

      Make sure to have a valid API token to use the API.

      1. As a user with permission to edit/add pages in a space, use the REST API to update the body of the pages.
      2. Make sure to use the representation as "view" under the body of the page.
      3. Run the update.

      As an example, these would API calls with "View" as the representation:

      curl --request PUT \
        --url 'https://INSTANCE.atlassian.net/wiki/rest/api/content/<content-id>' \
        -u '<EMAIL>:<API TOKEN>' \
        --header 'Accept: application/json' \
        --header 'Content-Type: application/json' \
        --data '{
        "version": {
          "number": 10
        },
        "title": "Creating a page to be changed via API",
        "type": "page",
        "body": {
          "view": {
            "value": "<p>PAGE BODY</p>",
            "representation": "view",
          }
        }
      }' 
      

      With an ID for the body:

      curl --request PUT \
        --url 'https://instance.atlassian.net/wiki/rest/api/content/<content-id>' \
        -u '<EMAIL>:<API-TOKEN>' \
        --header 'Accept: application/json' \
        --header 'Content-Type: application/json' \
        --data '{
        "version": {
          "number": 10
        },
        "title": "Creating a page to be changed via API",
        "type": "page",
        "body": {
          "view": {
            "value": "<p>TEXT HERE</p>",
            "representation": "view",
            "content": {
            "id": "BODY-ID"
            }
          }
        }
      }' 
      

      Expected Results

      The API should update the page content or an error message should be displayed.

      Actual Results

      The page is not updated and no error messages will be displayed.

      Workaround

      Different workarounds can be used for this one:

      Attachments

        Activity

          People

            Unassigned Unassigned
            gdecampos Giuliano C.
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: