I have the following use case: we use Confluence to document in a specific format the way work is carried out in Jira issues.
In this sense, the Confluence page will more or less contain the same description as the Jira issue.
Right now, we are doing this manually. Whenever I copy content from the Description field of a Jira issue (not while editing it) and I paste it in the Confluence page, the markups are in place and I see the content in Confluence as it is in Jira.
But I want to automate this process, with a webhook sending the issue details to a service which then creates a Confluence page via the REST API, which should contain the same content as the issue Description (an automatic copy-paste, if you want). But, when creating the page via the API, the markup is saved as pure text.
How should I set the body and representation types so that I get the same behaviour and view when using the REST API?
For example, when I copy paste manually, I get this:
----------------------
This issue is created in order to test Bug creation --> Jira Automation --> AWS Lambda --> Confluence API --> AWS Lambda --> Jira API functionality for automatically creating a Confluence page and linking it to the created Bug.
Here is a link to Google dot com, to test it
And here is a user mention: [redacted]
{
"keyString":"this is a JSON formatted piece of code",
"keyInteger": 1234,
"keyObject": {"innerKey": true}
}This text is preformatted
And here's a picture of a cat, bullet cat:

------------------------
But when I create the page via the API, I get this:
----------------------
<at:declarations /><h1>1 - Problem description</h1><p>This issue is created in order to test Bug creation --> Jira Automation --> AWS Lambda --> Confluence API --> AWS Lambda --> Jira APIfunctionality for automatically creating a Confluence page and linking it to the created Bug.
Here is a link to Google dot com, to test it
And here is a user mention: [redacted]
Error rendering macro 'code': Invalid value specified for parameter 'lang'
{
"keyString":"this is a JSON formatted piece of code",
"keyInteger": 1234,
"keyObject": {"innerKey": true}
}This text is preformatted
And here's a picture of a cat, bullet cat:

----------------------
The REST API reference should better explain the body types and representation values for when creating pages via the API.