Import a Word document using REST API

Georgi Yankov January 13, 2021

Hello,

In the end of a batch I need to upload a resultant MS Word document as a page in Confluence using programmatic way as REST API.

In the web portal the tool that works for me is Import Word Document from the link below but I don't see how it can be programmatically called.

https://confluence.atlassian.com/doc/import-a-word-document-into-confluence-170493136.html

Any other tools are welcome,

Thank you

2 answers

0 votes
Lim
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!
January 13, 2021

Is this link https://confluence.atlassian.com/doc/ is not working for you?

Georgi Yankov January 13, 2021

It is the same from my initial post and as I mentioned it works not the way I need to access it. It works perfect with a mouse and a web browser but I need to trigger it in command line from a web app server.

Like kiranmai.genkolla likes this
0 votes
Joey Musante January 13, 2021

Looks like someone found a solution here possibly! Possible solution 

Georgi Yankov January 13, 2021

It is a possible solution but has two disadvantages which makes it not acceptable to me:

1.  It produces not a native Confluence (HTML) page - The viewword macro just embed an iframe preview and the editing of the page is possible only with spacial add-ins.

2. Using Webdav suppose to mount permanently the 'file system' of the Confluence on my web app server which is generally not a good idea. 

Peter-I November 8, 2021

@Georgi Yankov , I'm also in search of a solution importing Word files via REST api. Can you share what was your solution?

Like kiranmai.genkolla likes this
Sven Alebrand
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!
November 18, 2021

I am not Georgi but I'd still like to share my solution: I converted all word files to txt-files using pandoc (pandoc.org) like so:

pandoc $file -f docx -t jira -s -o $file.Replace(".docx", ".txt")

Then, I imported these txt-files using the Atlassian Command Line Interface (see Marketplace) like so:

acli prod --action storePage --file $fileName --space $spaceKey --title $title --parent "My Parent Page"

This I did for hundrets of files using a powershell script. The results where pretty decent for well-formated Word-files.

Like # people like this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events