Missed Team ’24? Catch up on announcements here.

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

JIRA Automation (Data Center) Send Web Request: Proper format to populate page in the body

chilmcr
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 9, 2024

Hello. I have the ability to use the Send Web Request and have it create a page in the proper area in Confluence.  Awesome! I can't find anywhere that clearly explains how to make it choose a template. I'm in Data Center and I don't have a "Create Confluence Page", all I got is "Send Web Request".  I tried using the "Custom Data" box (I would have posted an image if I knew how) and pasting in some html stuff and got it to show a title ("body":{"storage":{"value":"<h3><title>Promote Checklist for </title></h3>",.)  PERFECT, that's a great start.

This is my code that works great to create my page in Confluence and shows my title. 

{
"type":"page",
"ancestors":[{"id":XXXXXXXXXX}],
"title":"{{issue.key}} Promote_Checklist",
"space":{"key":"EDW"},
"body":{"storage":{"value":"<h3><title>Promote Checklist for </title></h3>",
"representation":"storage"}}
}

 

What I cannot do (or understand) is this: Can someone please provide me an example of how I build a table so I can follow the pattern/syntax. For example, and I'll try to write this in English using my code.... How do I add (and what is the proper syntax) to create what I need to put a table on this Confluence page that is being created. I don't know where the commas, quotes or brackets are supposed to be and I'm assuming if I want to add a table, I need to put it in the "body" before the "representation", but I really have no clue what I'm talking about. Hopefully what I wrote is helpful. I'm so sorry. 

{
"type":"page",
"ancestors":[{"id":XXXXXXXXXX}],
"title":"{{issue.key}} Promote_Checklist",
"space":{"key":"EDW"},
"body":{"storage":{"value":"<h3><title>Promote Checklist for </title></h3>",

some space - meaning some white space between the title and the start of the table

Table Column1 Heading  Table Column 2  Heading Table Column 3 Heading

Table Row One

Table Row Two

Table Row Three

some space - meaning some white space between the two tables

Table2  Column1 Heading  Table2 Column 2  Heading Table2 Column 3 Heading

Table2 Row One

Table2 Row Two

Table2 Row Three

"representation":"storage"}}
}

1 answer

0 votes
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 10, 2024

When you use a template in confluence, it just populates the body.storage.value for your upon page creation.

So if you want to do this from the rest API, you will have to first fetch the appropriate template, make changes to the storage value with your own content, then post it back to your confluence application.

As far as the request goes, your tables should be inside the double quote for body.storage.value (after </h3> and before the "

"body":{"storage":{"value":"<h3><title>Promote Checklist for </title></h3>####YOUR TABLE HERE###",

My suggestion would be to use an existing page with a table similar to what you are looking for then inspect its storage format and attempt to repliacate it. Or you can write plain HTML to build your table.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events