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

Jira Automation sending to Confluence Rest API: How to encode the description field?

Stephanie Bryant October 19, 2024

This is a weird one for y'all.

I am using an automation to create a Confluence page with content from a Jira issue. It basically dumps a bunch of fields from an incident, including the description from the incident ticket.

Attached is a screen shot of the description field on the source issue (Picture1).

When I send it through the Confluence rest API via Jira automation, it comes through with all the formatting stripped out and rendered in plain text (Picture2).

This happens whether I use .htmlEncode or .jsonEncode at the end of the {{issue.description}} smart value. I cannot send this unencoded because the line breaks in the description body result in JSON errors. (So does trying to use the ADF as the representation type, so please don't suggest that.)

What encoding should I use to get the description field to render in a Confluence page along with its formatting?

Picture1: 

Picture1.png

Picture2:

 

Picture2.png

And because I know the #1 question will be "show us your automation!" here's the relevant part of the API call:

Picture3.png

1 answer

1 accepted

2 votes
Answer accepted
Bill Sheboy
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.
October 20, 2024

Hi @Stephanie Bryant -- Welcome to the Atlassian Community!

After some experimentation to confirm, I found .html rather than .htmlEncode gets the correct markup for passing to Confluence, and then follow that with jsonEncode for the Confluence update page endpoint:

https://developer.atlassian.com/cloud/confluence/rest/v2/api-group-page/#api-pages-id-put

 

For example, assuming my rule created the page and I saved the title in a variable the custom data could be this:

{
"id": "{{createdPage.id}}",
"status": "current",
"title": "{{varPageTitle}}",
"body": {
"representation": "storage",
"value": "{{issue.description.html.jsonEncode}}"
},
"version": {
"number": 2,
"message": "Adding some content"
}
}

 

Kind regards,
Bill

Stephanie Bryant October 22, 2024

BLESS YOU, Bill!!! That did the trick!

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
atlassian, atlassian community, university, on demand, transition to jira cloud

Transition to Jira Cloud

Switch to Jira Cloud with Atlassian University! Explore new navigation, issue views, and Cloud features like team-managed projects and automation. Tailored for Data Center users & admins, these courses ensure a smooth transition. Start your journey today!

Enroll now
AUG Leaders

Upcoming Jira Events