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

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Confluence Server API 8.5.2 Update Content Problem

Edited

I am using Python to connect to API. I want to find and replace some texts in pages with new texts while keeping the HTML/CSS formating.

But for Content-Type, the PUT API seems to only support "

application/json", "not "text/html" (415). The result is that all of my tags are interpreted as text and not as html tags when it updates.
So is there a way to do that?

1 answer

0 votes
Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 02, 2023

@jimqian, could you provide an example of what you are trying to insert? 

<p>apple apple.</p><p><span style="color: rgb(206,145,120);">New Sentence</span></p><p>banana</p><p><span style="color: rgb(206,145,120);">New Sentence.</span></p><p>orange</p><p><span style="color: rgb(206,145,120);">New Sentence.</span></p><p>pineapple</p>

I am basically trying to change "Old Sentence." to "New Sentence." for example. While ignoring things that are neither: like "pineapple" and also keeping the original formatting: like <p>, <span, and color.

Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 02, 2023

And it's being inserted directly as that? Are you inserting it inside of an HTML macro?

Also, are you putting in "&lt;p&gt;apple apple.&lt;/p&gt;..." are did it just render that way when you put it into the text box here?

No I did not use the HTML macro. What is that? Thank you very much for pointing it out!

Kian Stack Mumo Systems
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Nov 02, 2023

@jimqian, you need to enable it at the system level. https://confluence.atlassian.com/doc/html-macro-38273085.html

So basically:

1) Tell my wiki's admin to enable HTML macro and

2) Add {html} {html} around my html code when using API to put?

And btw would using scriptrunner instead of api circumvent this problem without having the admin enable html?

Nvm. And thank you Kian Stack Mumo Systems for your help!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events