Problem

      On Confluence 5.8.x and above, when using the REST API to extract the contents of a page, Confluence does not return the contents of the Table of Contents macro.

      Expected behavior

      When using the following REST call, the response should contain the contents of the TOC macro.

      curl -u admin:admin http://localhost:8090/confluence/rest/api/content/491524?expand=body.view
      {"id":"491524","type":"page","status":"current","title":"TOC/REST API test","body":{"view":{"value":"<p><style type='text/css'>/*<![CDATA[*/\ndiv.rbtoc1460022235112 {padding: 0px;}\ndiv.rbtoc1460022235112 ul {list-style: disc;margin-left: 0px;}\ndiv.rbtoc1460022235112 li {margin-left: 0px;padding-left: 0px;}\n\n/*]]>*/</style><div class='toc-macro rbtoc1460022235112'>\n<ul class='toc-indentation'>\n<li><a href='#TOC/RESTAPItest-heading1'>heading 1</a></li>\n<li><a href='#TOC/RESTAPItest-heading2'>heading 2</a></li>\n</ul>\n</div></p><h1 id=\"TOC/RESTAPItest-heading1\">heading 1</h1><h1 id=\"TOC/RESTAPItest-heading2\">heading 2</h1><p> </p>","representation":"view","_expandable":{"content":"/rest/api/content/491524"}},"_expandable":{"editor":"","export_view":"","anonymous_export_view":"","storage":""}},"extensions":{"position":"none"},"_links":{"webui":"/pages/viewpage.action?pageId=491524","tinyui":"/x/BIAH","collection":"/rest/api/content","base":"http://localhost:8090","context":"","self":"http://localhost:8090/rest/api/content/491524"},"_expandable":{"history":"/rest/api/content/491524/history","container":"","ancestors":"","children":"/rest/api/content/491524/child","descendants":"/rest/api/content/491524/descendant","space":"/rest/api/space/SDFDS","version":"","metadata":""}}

      Actual behavior

      On Confluence 5.8.x and above, the same call does not return the contents.

      curl -u admin:admin http://localhost:8090/confluence/rest/api/content/1605634?expand=body.view
      curl -u admin:admin http://localhost:8090/confluence/rest/api/content/1605634?expand=body.view
      {"id":"1605634","type":"page","status":"current","title":"TOC/REST API test","body":{"view":{"value":"<p><div class=\"toc-macro client-side-toc-macro \" data-headerelements=\"H1,H2,H3,H4,H5,H6,H7\"></div></p><h1 id=\"TOC/RESTAPItest-heading1\">heading 1</h1><h1 id=\"TOC/RESTAPItest-heading2\">heading 2</h1><p> </p>","representation":"view","_expandable":{"content":"/rest/api/content/1605634"}},"_expandable":{"editor":"","export_view":"","storage":"","anonymous_export_view":""}},"extensions":{"position":"none"},"_links":{"webui":"/pages/viewpage.action?pageId=1605634","tinyui":"/x/AoAY","collection":"/rest/api/content","base":"http://localhost:8090/confluence","context":"/confluence","self":"http://localhost:8090/confluence/rest/api/content/1605634"},"_expandable":{"container":"","metadata":"","operations":"","children":"/rest/api/content/1605634/child","history":"/rest/api/content/1605634/history","ancestors":"","version":"","descendants":"/rest/api/content/1605634/descendant","space":"/rest/api/space/SOME"}}

            [CONFSERVER-41313] Table of Contents macro is empty through REST API

            Any update for this issue?

            Phan Thien Long added a comment - Any update for this issue?

            Today we are facing this problem after the update from Confluence 5.7.6 to 5.8.18.

            After a bit of testing i tried to use the toc-plugin-2.6.12.jar from the Confluence 5.7 installation directory (/atlassian-confluence-5.7.6/confluence/WEB-INF/atlassian-bundled-plugins/) and copied it into the 5.8 atlassian-bundled-plugins location. Move toc-plugin-2.8.6.jar to a backup location. Then delete den Confluence plugin caches and then restart your web server.

            In the manage addon section you will see the old version.

            In my testing the TOC macro work through REST API. I don't see any error logs in Confluence.
            So for me this workaround seems to work.

            And when you look at the archived Marketplace listing... The version is compatible.
            https://marketplace.atlassian.com/plugins/org.randombits.confluence.toc/versions

            Is Confluence 5.10 also affected by this bug?

            Regards,
            Tim

            Tim Eddelbüttel added a comment - Today we are facing this problem after the update from Confluence 5.7.6 to 5.8.18. After a bit of testing i tried to use the toc-plugin-2.6.12.jar from the Confluence 5.7 installation directory (/atlassian-confluence-5.7.6/confluence/WEB-INF/atlassian-bundled-plugins/) and copied it into the 5.8 atlassian-bundled-plugins location. Move toc-plugin-2.8.6.jar to a backup location. Then delete den Confluence plugin caches and then restart your web server. In the manage addon section you will see the old version. In my testing the TOC macro work through REST API. I don't see any error logs in Confluence. So for me this workaround seems to work. And when you look at the archived Marketplace listing... The version is compatible. https://marketplace.atlassian.com/plugins/org.randombits.confluence.toc/versions Is Confluence 5.10 also affected by this bug? Regards, Tim

              Unassigned Unassigned
              pkoczan Peter Koczan (Inactive)
              Affected customers:
              9 This affects my team
              Watchers:
              7 Start watching this issue

                Created:
                Updated: