Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
Next:
badges earned

Your Points Tracker
Challenges
Leaderboard
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Recognition
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Kudos
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Rest API for Exporting PDF/Word Document Edited

Hi,

could you help us with the rest api for Exporting PDF/Word Document in Confluence.

Regards,

Kulasekhar

 

 

4 answers

0 votes
DPK J Community Leader Jan 22, 2020

@PASUPULA REDDY  There are no rest api's to export PDF/Word out of Confluence.

But there exists SOAP API's for this - https://developer.atlassian.com/server/confluence/remote-api-specification-for-pdf-export/

Please do verify if SOAP is working with your version of Confluence as Atlassian team is looking to deprecate it as soon as all its features are replicated in REST.

If you hover over the "Export to PDF" and the "Export to Word" buttons in Confluence you can see the links that are called when you press those buttons. You can do a GET on these URLs to get the objects.

So the URL would be something like (for PDF):

"confluenceurl" + "/spaces/flyingpdf/pdfpageexport.action?pageId=PAGE_ID"

The auto-generated filename is then in the "content-disposition" of the return object. But you can always set your own filename.

The content of the file is in the return object's content.

 

We use the above method and python to dynamically export pages to PDF when we need to.

 

Hope that helps!

@Elliot Sloman 

Hi,how about the URL for exporting Word?

Seems to work as well!

 

The URL is simpler and something like this:

 

"CONFLUENCE_URL" + "exportword?pageId=PAGE_ID"

 

Like above, the filename is in the content-disposition header but you can always set your own if you don't want the auto-generated file name.

The content of the file is in the "content" of the return object. You can simply write that to a file.

 

I tested this morning with a bit of python code and it worked fine.

@Elliot Sloman 

It doesn't work for me.My confluence server is local. 

How can I export word using template?

I have tried rest api GET 'http://CONFLUENCE_URL/plugins/servlet/scroll-office/api/public/1/export-sync?templateId=com.k15t.scroll.office.default-template-1&pageId=67415595'

But the response downloaded word is error coding. 

And I also tried the rest api POST 'http://CONFLUENCE_URL/plugins/servlet/scroll-office/api/public/1/exports'

But the response is {
"status": 403,
"message": "User not allowed to export because of export restrictions on either space or groups."
}

According to the document https://help.k15t.com/scroll-pdf-exporter/latest/server/export-content-via-rest-api-125699615.html

Hi @PASUPULA REDDY ,

you might want to have a look at our Scroll PDF Exporter, which lets you easily create templates using a graphical template designer, without the need to know any CSS.

Additionally you can use our REST API (or even Java API) to perform exports automatically.

Scroll PDF Exporter is available via the Atlassian Marketplace and can be tested using a free evaluation license.

Cheers,
Nils

Hi,

 

thanks for the reply, It would be great for us if you share the code along with the http head managers.

 

Regards,

Kulasekhar

Like Ronaldo Huang likes this

I'm working on the same type of issue but only for pdf's.  If you're using Python, you can use the confluence package (https://atlassian-python-api.readthedocs.io/confluence.html) and the export_page function for pdf.

confluence.export_page(page_id)

As the doc indicates, if you're using Confluence Cloud, make sure when you instantiate confluence that you set the api_version to cloud.


confluence = Confluence( url='https://yourcompany.atlassian.net/', api_version='cloud', username=username, password=password)

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Confluence

🥓🙅🏻‍♀️ Meet-less May Badge!

Hello Confluence Community!  What if i told you that you could have a healthier life and be 100% meet-less? This month, we're promoting a healthy, balanced work diet with Confluence. (Read m...

548 views 3 23
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you