How to get code blocks from a page?

Zain Farooq June 24, 2022

My company has separate confluence instances set up for two different teams. I was tasked with making an import/export tool so that we could transfer pages that are relevant for both teams between the two instances. Currently, I am able to get the base page html, comments, and attachments using the REST API, but I cannot find any documentation on how to get code blocks from the pages. Is there any REST API call that will allow me to achieve this? Thank you!

1 answer

0 votes
Benjamin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 26, 2022

Hi @Zain Farooq ,

 

I'm recalling that this can be done as long you are able to get the full page along with the macros. If you are just getting base page html, it will not be enough as you can be missing other contact from macros besides code-blocks.

 

Thanks,

 

Ben

Zain Farooq June 27, 2022

Hi @Benjamin ,

 

After inspecting the page html we found that it is an xhtml file with the macros contained within xml tags. We are able to get the page body but are unfamiliar with how to programmatically display the fetched page in our import preview page. Could you guide us in how to go about doing this?

 

Thanks,

Zain

Benjamin
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 28, 2022

Hi @Zain Farooq ,

 

Here's some postings of similar on similar topics:

 

https://community.atlassian.com/t5/Confluence-questions/How-can-I-sync-two-Confluence-instances-in-both-directions/qaq-p/608359

 

https://community.atlassian.com/t5/Confluence-questions/Synchronizing-two-Confluence-Instances/qaq-p/713034

 

You maybe want to possibility of copying the raw storage format to the other confluence space.

 

You may want to revisit the entire requirement itself. Like why can't the teams be on one confluence?

 

If they are on the same confluence, it will be simpler to just have the other team be on a separate space and just use the include macro for the pages you want to share across to the other team. 

 

-Ben

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events