Trying to set a template to a page.

Sufficient Monk January 6, 2022

Hey guys.

AIM: There are some templates available on my companies confluence page.
I want to use 1 of them when I am making a page.

My Questions and What I have tried till now.
1)
When making  a page with the REST API, I do not see any body parameter which I could use to set the template I would like to use.
https://developer.atlassian.com/cloud/confluence/rest/api-group-content/#api-wiki-rest-api-content-post

2) If the template is indeed passed in the body parameter during page creation, do I need to find out the ID of the template I plan to use? 
I tried to find out the information about the template on my companies server by following this link.
https://developer.atlassian.com/cloud/confluence/rest/api-group-template/#api-wiki-rest-api-template-page-get
But All I get is the following error!
doubt5.png

Thank you for your time! I hope the question is well enough formatted for the reader.




1 answer

1 accepted

1 vote
Answer accepted
Bastian Stehmann
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
January 6, 2022

Hi @Sufficient Monk ,

There is no way to select a template while creating a page with REST API.

You can try to get the template in storage format, extract the storage format and add that to the body when creating the new page. If you want to add some own content during creation you can modify the storage format data.

There is an experimental API to get the template, here is a question I once had where it is explained. 

https://community.atlassian.com/t5/Confluence-questions/Get-a-template-in-storage-format-via-Confluence-REST-API/qaq-p/978620

Sufficient Monk January 6, 2022

Thank you so much for the real;ly quick answer. I was able to complete my task because of you. Good night. And hope you the best of luck!! 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events