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

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

    XMLWordPrintable

Details

    Description

      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",
      });

      Attachments

        Issue Links

          Activity

            People

              kkaushik@atlassian.com Kuldeep
              vsiqueira Vinicius
              Votes:
              22 Vote for this issue
              Watchers:
              32 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: