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

Creating a page via API doesn't load the New Editing Experience

      Issue Summary

      When our instance is rolled out to the new editing experience if we create a new page or space using API, this page and space is created in the old editor and are not converted to the new editing experience when edited.

      Environment

      • Cloud
      • New Editing Experience

      Steps to Reproduce

      1. Create a page via API - you can use the below curl:
        curl -i -X POST \
            -u '<email_address>:<API_TOKEN>' \
            -H 'Accept: application/json' \
            -H 'Content-Type: application/json' \
            -d '{
                  "title": "<PAGE_TITLE>",
                  "type": "page",
                  "space": {
                    "key": "<SPACEKEY>"
                  },
                  "status": "current",
                  "body": {
                    "storage": {
                      "value": "<p>Better days will come :D</p>",
                      "representation": "storage"
                    }
                  }
                }' \
            https://<SITE_NAME>.atlassian.net/wiki/rest/api/content 

        To create your API token, jump here

      1. Go to the page you just created;
      2. It is with the old editor, try to edit it.
        And
      3. Create a space via API - you can use the below curl:
        curl --user someUser@myDomain.com:apiTokenHere -
        -request POST --url 'https://<SITE_NAME>.atlassian.net/wiki/rest/api/space' 
        --header 'Accept: application/json' 
        --header 'Content-Type: application/json' 
         --data '{"key":"ACS","name": "API Created Space","description": {"plain": {"value": "someValue","representation": "someRepresentation"}}}'
        

        Expected Results

      When accessing the page/space overview page, the published version should be already in the new editor, but even editing it, the page should be converted to the new editing experience.

      Actual Results

      The pages is with the old editor and doesn't get converted.

      Workaround

      It's possible to simply add the following metadata to the request's payload, so the page will be created using the new editor:

      "metadata": {
          "properties": {
              "editor": {
                  "key": "editor",
                  "value": "v2"
              }
          }
      }

      Here's a complete example;

      fetch("https://INSTANCE.atlassian.net/wiki/rest/api/content", {
          "credentials": "include",
          "headers": {
              "content-type": "application/json",
          },
          "body": `{
      		"title": "Test new page (API)",
      		"type":"page",
      		"status":"current",
      		"space":{
      			"key":"TS"
      		},
      		"body": {
      			"storage": {
      				"value": "<p>Created through the REST API</p>",
      				"representation": "storage"
      			}
      		},
      		"metadata": {
              		"properties": {
                			"editor": {
                  				"key": "editor",
                  				"value": "v2"
                			}
              		}
            		}
      	}`,
          "method": "POST",
      });

            [CONFCLOUD-68057] Creating a page via API doesn't load the New Editing Experience

            K. Ariga made changes -
            Link New: This issue was cloned as CONFCLOUD-78803 [ CONFCLOUD-78803 ]
            Jeremy Wright made changes -
            Comment [ FYI if you're still having trouble with this...I was able to resolve the issue by switching to API v2. You have to update the request body a bit from API v1 but it's working as expected now and there's no need to set the v2 editor in the metadata as had been suggested in previous workarounds. ]
            Nitika Arora made changes -
            Link New: This issue relates to CONFCLOUD-72852 [ CONFCLOUD-72852 ]
            Giuliano C. made changes -
            Resolution New: Fixed [ 1 ]
            Status Original: Long Term Backlog [ 12073 ] New: Closed [ 6 ]
            SET Analytics Bot made changes -
            UIS Original: 0 New: 1
            SET Analytics Bot made changes -
            UIS Original: 1 New: 0
            SET Analytics Bot made changes -
            UIS New: 1
            Bugfix Automation Bot made changes -
            Support reference count Original: 20 New: 21
            Bugfix Automation Bot made changes -
            Support reference count Original: 19 New: 20
            Bugfix Automation Bot made changes -
            Support reference count Original: 18 New: 19

              kkaushik@atlassian.com Kuldeep
              vsiqueira Vinicius (Inactive)
              Affected customers:
              22 This affects my team
              Watchers:
              32 Start watching this issue

                Created:
                Updated:
                Resolved: