Is there an API for creating the content of confluence pages?

Gareth Hughes September 27, 2011

Hi,

I want to write a piece of code that will create documentation for my software project in a Confluence page. I intend to use the xml-rpc connection to do it. What I am looking for is an API for creating the headings, titles etc. of the content of that page.

I understand the wiki markup text and I have a horrible feeling that it is my problem to just build strings full of {h1} etc rather than work with some nice API to createHeading1()

Any hints?

Thanks very much

5 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Answer accepted
JamieA
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.
September 27, 2011

That's very much the case, at least pre-v4. With v4 the format is structured and parseable so there may well be new APIs at least in the pipeline.

But at least in 3.5 I use something like this (soap, not xml-rpc):

def text = getClass().getClassLoader().getResourceAsStream('confluence/default_page.txt')?.text
RemotePage pageHome = service.getPage(token, pkey, 'Home')
pageHome.content = text
service.updatePage(token, pageHome, new RemotePageUpdateOptions(minorEdit: true, versionComment: "Update"))

Gareth Hughes September 27, 2011

Thanks for the answer. Ideally I want to build up some kind of DOM and then have the ability to dump the result to Confluence format or other formats such as PDF. It feels like a job for FOP or Velocity or those kinds of projects (that I have not kept up with)

JamieA
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.
September 27, 2011

The new format is XHTML so in theory you could use any standard xhtml parser/builder... however I think I read that there is no API to set the XHTML content directly. Could be wrong though.

Matthew Erickson
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 28, 2011

Hi Jamie,

In Confluence 4.0 you are able to set the content of a page as XHTML by using the version 2 remote API. See https://developer.atlassian.com/display/CONFDEV/Changes+to+the+remote+API+in+Confluence+4.0

1 vote
yafimc@zahav.net.il July 29, 2016

question :   what service reference  should I  add  to  my  .NET C#  project  for  implementing   this  code ?

many  thanks

Yafim

yafimc@zahav.net.il

 

1 vote
Pradeep Pandit July 25, 2016

is it possible for one of you guys please post code example here to help

1 vote
Aoyon Chowdhury September 28, 2011

The V2 XML-RPC APIs works well. There are no api for creating the xhtml though - but once you have the content in xhtml, you can use the apis to publish to confluence.

0 votes
nodejsgurj1 April 23, 2017

star()

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events