Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Can we create a Confluence Page from a template via REST API?

I'm trying to use the "Send web request" option in JIRA's Project Automation to generate a Confluence Page via REST API

I'm able to use the following code but I don't know how to force Confluence to use an existing template or a global template like "Design Review" when creating the new page.

 

{
"title": "ABCD",
"type": "page",
"space": { "key": "ABC" },
"status": "current",
"body": {"storage": {"value": "Sample Text", "representation": "storage"}}
}

1 answer

0 votes
sshannon I'm New Here Sep 11, 2021

You can do this with an undocumented rest api. 

 

First create a new page using the content api as a type of draft:

POST https://company.atlassian.net/wiki/rest/api/content

```

{
    "type""page",
    "status" : "draft",
    "title""test6",
   ...

```

Use the id retreived from this page to update the draft from a template:

PUT https://company.atlassian.net/wiki/rest/api/content/content_id/instance

```

{

{"content":{"id":"content_id","type":"page","title":"employee 1","status":"draft","space":{"key":"HR"},"version":{"number":1},"ancestors":[{"id":"content_id"}]},"contentBlueprintSpec":{"contentTemplateId":"template_id","context":{"employee_name":"a","employee_type":"a"}}}

}

```

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
Community showcase
Published in Confluence

Confluence Mythbusters: Does Atlassian even use Confluence?

Hi, Confluence collaborators! As part of #Confluence-Collaboratory month, we’ve created a very special Mythsbusters segment, where we're dive into an interesting myth and uncover the truth behind i...

1,455 views 7 29
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you