Forums

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

Is there a way to import a XML file as a Confluence Pace using RESt API Call or CLI

Santanu Roy
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, 2021

Using JIRA - Data Center Version.

I have a simple XML file with below three headers along with its corresponding content

 

User Story Name :XXXXXX

Description : YYYYYYYY

Acceptance Criteria : ZZZZZZZZ

 

Is it possible to import this .xml file onto a Confluence Page using the REST API Call.

 

1 answer

0 votes
Thomas Deiler
Community Champion
April 20, 2021

Dear @Santanu Roy ,

sure it is. I assume that you would like to display the 3 headers like panels or other structured elements on  a page.

All you need is the documentation to the REST API and a browser extension to test your rest calls.

The way how to do:

  • create a page like the XML data should be displayed - a sample page
  • read this page with the rest call GET /rest/api/content
  • Whats returned is JSON. Now you know how it is strucured.
  • Replace the content in this JSON with the data from your XML
  • POST /rest/api/content will create a new page with your modified JSON

You will find some samples here. I recommend to use a script language like Python or PHP to write some simple code to repeat the REST calls in an easy way without the browser extension.

So long

Thomas

Note: If you just want to upload the XML as an attachment to an existing page, serach for this at the samples.

Thomas Deiler
Community Champion
May 5, 2021

Dear @Santanu Roy ,

was my answer useful? Then I would be happy when you click on the "green accept answer" button.

So long
Thomas

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events