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

            MS added a comment -

            I am also having this issue when creating pages with Python. And I found that some pages restored by the Rewind Backup product also had this issue. On first examination, it appears that these were simple pages without any new editor macros.

            MS added a comment - I am also having this issue when creating pages with Python. And I found that some pages restored by the Rewind Backup product also had this issue. On first examination, it appears that these were simple pages without any new editor macros.

            Jon Booth added a comment -

            Hey I don't know if anyone is still watching this old issue - however, I've got exactly the same problem when using the new v2 api with rest. https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-post

            Since this ticket comes up and is referenced to when you search around for this problem, I'm wonderin if it can be reopened or a new work around described here please? 

            Jon Booth added a comment - Hey I don't know if anyone is still watching this old issue - however, I've got exactly the same problem when using the new v2 api with rest. https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-post Since this ticket comes up and is referenced to when you search around for this problem, I'm wonderin if it can be reopened or a new work around described here please? 

            Hi Giuliano,

            I tried the official REST API, and ended up with the same error.

            Could you kindly take a look at this?
            https://community.developer.atlassian.com/t/a-page-created-via-api-is-not-displayed-with-error-this-editor-does-not-support-displaying-this-content/52403/4
            If i have a clue, such as html tags or a specific structure not to be used in page body, that will helpful.

            Also, thanks a lot for other info on atlassian-python-api, though it'll take time for me to do these.

            Masaya YAMAMOTO added a comment - Hi Giuliano, I tried the official REST API, and ended up with the same error. Could you kindly take a look at this? https://community.developer.atlassian.com/t/a-page-created-via-api-is-not-displayed-with-error-this-editor-does-not-support-displaying-this-content/52403/4 If i have a clue, such as html tags or a specific structure not to be used in page body, that will helpful. Also, thanks a lot for other info on atlassian-python-api, though it'll take time for me to do these.

            Dear gdecampos, thanks for the quick feedback. I assume you have no ETA when this be fixed, right? I hope at least, it will not take 2 years like here^^

            Lars Stuber added a comment - Dear  gdecampos , thanks for the quick feedback. I assume you have no ETA when this be fixed, right? I hope at least, it will not take 2 years like here^^

            Hello 48029e779fef,

            We appreciate all your efforts to raise a new request in our developer community and also bringing it here, which indicates that this could be definitely related.

            While the changes/fixes to our API could have caused the current symptoms that you are noticing, the script used comes from a third-party library (https://atlassian-python-api.readthedocs.io/) that is not officially supported nor developed by Atlassian, my friend. In this case, if you attempt to create a new page using the official REST call (not from the script), will that allow you to view it properly, using the new/current editor due to this fix?

            If so, a good catch could be to go to the Github page for the library > Issues, then, select the New issue option: https://github.com/atlassian-api/atlassian-python-api/issues

            If it helps, I could also see that there was a release for the Confluence code in the script, 12 days ago, putting parameters tied to the editors used: https://github.com/atlassian-api/atlassian-python-api/commit/519813a5f910af4984c32af3949637424133c289

            I hope it helps, Masaya! However, feel free to let us know if there is any observation to be looked from the Atlassian side. We will be more than happy to help!

            Wish you the best,
            Giuliano C.
            Atlassian Team

            Giuliano C. added a comment - Hello 48029e779fef , We appreciate all your efforts to raise a new request in our developer community and also bringing it here, which indicates that this could be definitely related. While the changes/fixes to our API could have caused the current symptoms that you are noticing, the script used comes from a third-party library ( https://atlassian-python-api.readthedocs.io/ ) that is not officially supported nor developed by Atlassian, my friend. In this case, if you attempt to create a new page using the official REST call (not from the script), will that allow you to view it properly, using the new/current editor due to this fix? If so, a good catch could be to go to the Github page for the library > Issues , then, select the New issue option: https://github.com/atlassian-api/atlassian-python-api/issues If it helps, I could also see that there was a release for the Confluence code in the script, 12 days ago, putting parameters tied to the editors used: https://github.com/atlassian-api/atlassian-python-api/commit/519813a5f910af4984c32af3949637424133c289 I hope it helps, Masaya! However, feel free to let us know if there is any observation to be looked from the Atlassian side. We will be more than happy to help! Wish you the best, Giuliano C. Atlassian Team

            Hi lars.stuber,

            I want to thank you for testing it and bringing this opportunity, friend!

            Unfortunately the implementation does not fix the creation of new spaces via API. The overview page is still created with Legacy Editor.

            Can you please verify that this shouldn't be fixed with your mentioned fix?

            I do confirm that the current fix does not fix the creation of new spaces via API and we just discovered it thanks to your comment. After testing it, I was able to reproduce this issue and created the new bug below so we can fix it at a code level:

            Feel free to add yourself as a watcher and even share your thoughts there. The closest workaround that I've found was to edit the home page once it gets created, which will automatically open it in the new editor.

            Thank you again, Lars!

            Wish you the best,
            Giuliano C.
            Atlassian Team

            Giuliano C. added a comment - Hi lars.stuber , I want to thank you for testing it and bringing this opportunity, friend! Unfortunately the implementation does not fix the creation of new spaces via API. The overview page is still created with Legacy Editor. Can you please verify that this shouldn't be fixed with your mentioned fix? I do confirm that the current fix does not fix the creation of new spaces via API and we just discovered it thanks to your comment. After testing it, I was able to reproduce this issue and created the new bug below so we can fix it at a code level: Creating spaces via API doesn't load the new/current editor for the home page Feel free to add yourself as a watcher and even share your thoughts there. The closest workaround that I've found was to edit the home page once it gets created, which will automatically open it in the new editor. Thank you again, Lars! Wish you the best, Giuliano C. Atlassian Team

            Masaya YAMAMOTO added a comment - - edited

            Hello @Guiliano ,

            I have a ploblem which this topic might be related or similar.

            A page created on Confluence cloud via api using Atlassian Python API wrapper *1 is not displayed with error “This editor does not support displaying this content”.

            error screeen capture

            *1 Confluence module — Atlassian Python API 3.14.0 documentation

             

            Could you please take a look at this and give me a hint?

            A page created via API is not displayed with error "This editor does not support displaying this content" - Confluence Development - The Atlassian Developer Community

            Thank you in advance,

            Masaya

            Masaya YAMAMOTO added a comment - - edited Hello @Guiliano , I have a ploblem which this topic might be related or similar. A page created on Confluence cloud via api using Atlassian Python API wrapper *1 is not displayed with error “This editor does not support displaying this content”. error screeen capture *1  Confluence module — Atlassian Python API 3.14.0 documentation   Could you please take a look at this and give me a hint? A page created via API is not displayed with error "This editor does not support displaying this content" - Confluence Development - The Atlassian Developer Community Thank you in advance, Masaya

            Hi @Giuliano,

            thanks for the update. Unfortunately the implementation does not fix the creation of new spaces via API. The overview page is still created with Legacy Editor.

            Can you please verify that this shouldn't be fixed with your mentioned fix?

            Thanks in advance!

            Lars

            Lars Stuber added a comment - Hi @Giuliano, thanks for the update. Unfortunately the implementation does not fix the creation of new spaces via API. The overview page is still created with Legacy Editor . Can you please verify that this shouldn't be fixed with your mentioned fix? Thanks in advance! Lars

            No problems, sasha2! It's Atlassian that has to thank you for the opportunity for improvement.

            As for your inquiries:

            But could you tell us if it is still possible to create pages via API to open (for edit) in legacy editor? I can do that only if I create a page that cannot be converted (for example if it contains bodied bested macros), but is there a flag/parameter to give with API call to ensure it always opens in legacy editor?

            The workaround used by you would be the current recommendation so the conversion to the current/new editor would not happen. We actually appreciate you sharing it so it can help customers in the same situation, needing the legacy editor pages to be created via API.

            Wish you the best,
            Giuliano C.
            Atlassian Team

            Giuliano C. added a comment - No problems, sasha2 ! It's Atlassian that has to thank you for the opportunity for improvement. As for your inquiries: But could you tell us if it is still possible to create pages via API to open (for edit) in legacy editor? I can do that only if I create a page that cannot be converted (for example if it contains bodied bested macros), but is there a flag/parameter to give with API call to ensure it always opens in legacy editor? The workaround used by you would be the current recommendation so the conversion to the current/new editor would not happen. We actually appreciate you sharing it so it can help customers in the same situation, needing the legacy editor pages to be created via API. Wish you the best, Giuliano C. Atlassian Team

            Hi

            Thanks @Giuliano

            But could you tell us if it is still possible to create pages via API to open (for edit) in legacy editor?

            I can do that only if I create a page that cannot be converted (for example if it contains bodied bested macros), but is there a flag/parameter to give with API call to ensure it always opens in legacy editor?

            Alex

            Alex Medved {ConfiForms} added a comment - Hi Thanks @Giuliano But could you tell us if it is still possible to create pages via API to open (for edit) in legacy editor? I can do that only if I create a page that cannot be converted (for example if it contains bodied bested macros), but is there a flag/parameter to give with API call to ensure it always opens in legacy editor? Alex

            Hello, everyone!

            For all the watchers of this request, we are proud to confirm that a fix has been deployed to production, allowing you to create brand new pages with the new/current editor as a default behavior.

            Thank you for your patience and feedback towards this functionality. Thanks to you, we are able to improve the products, providing you with the experience deserved as an Atlassian customer.

            Wish you the best,
            Giuliano C.
            Atlassian Team

            Giuliano C. added a comment - Hello, everyone! For all the watchers of this request, we are proud to confirm that a fix has been deployed to production, allowing you to create brand new pages with the new/current editor as a default behavior. Thank you for your patience and feedback towards this functionality. Thanks to you, we are able to improve the products, providing you with the experience deserved as an Atlassian customer. Wish you the best, Giuliano C. Atlassian Team

            Is there also a workaround for creating a completely new SPACE? When I create a new space via API, it will create an overview page in v1 editor. Adding metadata or anything else does not change this. So is there any workaround for SPACE creation with v2 editor experience?

            Lars Stuber added a comment - Is there also a workaround for creating a completely new SPACE ? When I create a new space via API, it will create an overview page in v1 editor. Adding metadata or anything else does not change this. So is there any workaround for SPACE creation with v2 editor experience?

            Just got an answer from support, you can create a new page with the new editing experience by choosing a different representation and adding some metadata:

            curl --location --request POST 'https://<Site_Name>.atlassian.net/wiki/rest/api/content' \
            --header 'Accept: application/json' \
            --header 'Content-Type: application/json' \
            --data-raw '{
              "type": "page",
              "title": "<Page Title>”,
              "space": {
                "key": “<Enter-Key>”
              },
             "body": {
                "editor": {
                  "value":"{\"version\":1,\"type\":\"doc\",\"content\":[{\"type\":\"paragraph\",\"content\":[{\"type\":\"text\",\"text\":\"Some text in a paragraph\"}]}]}",
                  "representation":"atlas_doc_format"
                }
              },
              "metadata": {"properties": [{"editor2": "True"}]}
            }' 

             

            note the keys 'body.representation' and 'metadata.properties[].editor2'

            Waldemar Reusch added a comment - Just got an answer from support, you can create a new page with the new editing experience by choosing a different representation and adding some metadata: curl --location --request POST 'https: //<Site_Name>.atlassian.net/wiki/ rest /api/content' \ --header 'Accept: application/json' \ --header 'Content-Type: application/json' \ --data-raw '{ "type" : "page" , "title" : "<Page Title>”, "space" : { "key" : “<Enter-Key>” }, "body" : { "editor" : { "value" : "{\" version\ ":1,\" type\ ":\" doc\ ",\" content\ ":[{\" type\ ":\" paragraph\ ",\" content\ ":[{\" type\ ":\" text\ ",\" text\ ":\" Some text in a paragraph\ "}]}]}" , "representation" : "atlas_doc_format" } }, "metadata" : { "properties" : [{ "editor2" : "True" }]} }'   note the keys 'body.representation' and 'metadata.properties[].editor2'

            I have successfully used the workaround described by Lukas (commented above). Through the API a page gets created in old editor experience. However, I can then make a successful call to toggle the property to the new editor.

            Pete Dunham added a comment - I have successfully used the workaround described by Lukas (commented above). Through the API a page gets created in old editor experience. However, I can then make a successful call to toggle the property to the new editor.

            Felix Code added a comment -

            I've found a way to solve this issue, but only when creating a new page,  you may refer to Use Confluence Cloud REST API to create page with new editing experience.

            Felix Code added a comment - I've found a way to solve this issue, but only when creating a new page,  you may refer to Use Confluence Cloud REST API to create page with new editing experience.

            @Marcin - Confirming this! An API PUT call (only provide id, version, type and title) turns the old editor experience into a new editor experience. Could someone from @Atlassian confirm if this is a valid workaround?

            Lukas Gotter _ Meetical added a comment - @Marcin - Confirming this! An API PUT call (only provide id, version, type and title) turns the old editor experience into a new editor experience. Could someone from @Atlassian confirm if this is a valid workaround?

            Can you try updating the pages via API to see if that helps? Because the issue we have, is that a page created in the old editor gets turned into the new one after updating it via API, which breaks the formatting (for example the line spacing changes so there are really wide gaps), but maybe that will be the result you expect.
            Just do a PUT call onto the ID of the page, might not even need to change anything other than the version.

            Marcin Adamski added a comment - Can you try updating the pages via API to see if that helps? Because the issue we have, is that a page created in the old editor gets turned into the new one after updating it via API, which breaks the formatting (for example the line spacing changes so there are really wide gaps), but maybe that will be the result you expect. Just do a PUT call onto the ID of the page, might not even need to change anything other than the version.

            Our teams would love to use the API to manipulate docs, but this blocks us from adopting more confluence use cases. It also means that documents opened on some mobile devices dont work correctly.

            V(esper) Luckey added a comment - Our teams would love to use the API to manipulate docs, but this blocks us from adopting more confluence use cases. It also means that documents opened on some mobile devices dont work correctly.

            Just want to mention that the current workaround that our team is using is to cut/copy the content from the page under the old editor and to create an entirely new page, pasting the contents in, then publishing the page. This is slow, but we are currently migrating pages one at a time from an old wiki space that we imported from an old wiki through the api. Here is a quick description of the steps we use:

            1. Go into edit mode of the affected document and select everything in the document and Ctrl + X (cut) it to your clipboard.
            2. Create a new page from a template (blank works too) and paste the contents in.
            3. Make any changes as needed and publish the page
            4. The page can now be modified using the new editor.

            Deleted Account (Inactive) added a comment - Just want to mention that the current workaround that our team is using is to cut/copy the content from the page under the old editor and to create an entirely new page, pasting the contents in, then publishing the page. This is slow, but we are currently migrating pages one at a time from an old wiki space that we imported from an old wiki through the api. Here is a quick description of the steps we use: Go into edit mode of the affected document and select everything in the document and Ctrl + X (cut) it to your clipboard. Create a new page from a template (blank works too) and paste the contents in. Make any changes as needed and publish the page The page can now be modified using the new editor.

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

                Created:
                Updated:
                Resolved: