How to create page properties macro using REST API?

Nitesh yadav January 3, 2022

I am following the API reference given below:
https://developer.atlassian.com/cloud/confluence/rest/api-group-content-properties/#api-wiki-rest-api-content-id-property-post

But, the example is not well-crafted. I am not getting how to pass my content in the page properties macro and nothing present about "value" keyword.

Basically I want to create a Table as page properties in the confluence page so that I can link it to some other page. For testing purpose the payload that I am using is given below:

```

payload = {
        "key""spiderman_test1",
        "value":[],
        "body": {
            "storage": {
                "value""<p>Enjoy the API</p>",
                "representation""storage",
            }
        }
    }

```

But it didn't reflected any change on the actual page.

 

Please help me out in what should be the payload for this api. Thanks!

2 answers

2 votes
Dominic Lagger
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 5, 2022

Hi @nitesh yadav 

I'm not sure, whether you can just update a table with confluence REST API.

What I would do is: 

  1. Get the actual Content
  2. Change the content
  3. Put back the content

Your payload code needs the storage value of a page. Would be something like this

"body":{"storage":{"value":"<ac:structured-macro ac:name=\"details\" ac:schema-version=\"1\" data-layout=\"default\" ac:local-id=\"4d09c679-fc74-42e0-b299-b42b0f2374d6\" ac:macro-id=\"9aaba42d-3e46-49e5-92e2-de133b81965f\"><ac:rich-text-body><table data-layout=\"default\" ac:local-id=\"ea2f8c8e-ec48-49ab-bc8e-3d635f6fc357\"><colgroup><col style=\"width: 226.67px;\" /><col style=\"width: 226.67px;\" /><col style=\"width: 226.67px;\" /></colgroup><tbody><tr><th><p><strong>Test</strong></p></th><th><p><strong>test</strong></p></th><th><p><strong>test</strong></p></th></tr><tr><td><p>a</p></td><td><p>b</p></td><td><p>c</p></td></tr><tr><td><p>d</p></td><td><p>e</p></td><td><p>f</p></td></tr></tbody></table></ac:rich-text-body></ac:structured-macro>","representation":"storage"

Hope this helps

Regards, Dominic

0 votes
Sven Schatter _K15t_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
January 5, 2022

Just as a general tip: if you're working with page or space properties a lot, I can recommend the Property Inspector by Lively Apps. It's a free app that lets you view and edit properties in a UI. Quite helpful for debugging and changing pages to use the old editor. :)

EDIT: Whoops, I think you were talking about the Page Properties Macro and not about Page Properties? If that's the case: please ignore my answer.

Cheers,
Sven

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events