Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Can you add a multiline string in plain text via the Confluence API to a web page?

Louis Gallo
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!
April 19, 2019

I am new to programming with Confluence. I am using Python 3 and the Confluence API to create Confluence pages.

The one thing that I cannot figure out is if I can add a multiline string to a Confluence page via the API?

It seems to strip all my carriage return line feeds and sticks everything on one line.

Example: (Python)

#Declare my multiline string

myString = '''a

b

c'''

When I use this call:

# Creating page in confluence
create_page_result = confluence.update_or_create(
    parent_id=9999999,
    title= 'My Test Page',
    body=myString

It writes this string to the new Confluence page all on one line:

a b c

Is there any way around this?

Help!!!

Thanks,

Lou

1 answer

0 votes
John Fetzik
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.
April 19, 2019

You probably need to use the inline newline escape sequence, "\n". Check out the following page for more details.

https://confluence.atlassian.com/jirakb/how-to-insert-a-new-line-when-using-lines-the-jira-core-rest-api-779160736.html

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events