Purpose

How do we remove existing Scaffolding data from a Table Data macro using API?

Answer

  1. First, run the GET REST API to get the structure of the JSON.

    {confluence-url}/rest/scaffolding/1.0/api/form/{pageID}
  2. You should get the results below:

    [
        {
            "macro": "table-data",
            "name": "tabledata",
            "value": {
                "0": [
                    {
                        "macro": "text-data",
                        "name": "text1",
                        "value": "<p>Text1 Test</p>"
                    },
                    {
                        "macro": "text-data",
                        "name": "text2",
                        "value": "<p>Text2 Test</p>"
                    }
                ],
                "1": [
                    {
                        "macro": "text-data",
                        "name": "text1",
                        "value": "<p>Text1 Test 2</p>"
                    },
                    {
                        "macro": "text-data",
                        "name": "text2",
                        "value": "<p>Text2 Test 2</p>"
                    }
                ]
            }
        }
    ]
  3. Then, change the value to empty:

    [
        {
            "macro": "table-data",
            "name": "tabledata",
            "value": ""
        }
    ]
  4. Run the PUT method using the JSON body in Step 3 with the same REST API as Step 1:

    {confluence-url}/rest/scaffolding/1.0/api/form/{page-id}