How do I export all pages below a page in confluence using a script

亡梦爱人 提交于 2019-12-24 01:58:16

问题


I'm capturing meeting notes in a page structure in confluence. I want to export all the meeting notes to a share drive for others to read. I've found notes on how to export a page or a space but not the pages below a page. e.g. I want everything below "Parent Page" but not anything else.

e.g.

  Space
    Unrelated Pages
    Unrelated Pages
    Parent of Parent
      Parent Page
          Child Page 1
          Child Page 2
          Child page 3

I want to drag the child pages to a share drive. I'm looking to use one of the following e.g. curl, .bat files, python, R etc.

This is on the cloud version of confluence


回答1:


My first instinct was to give the "other" folks who want to read the meeting notes, (read) access to confluence itself - thats what confluence was meant for.

But if you're dead set on living in the 90s and downloading stuff to another drive, you can try the Page Tree Word Exporter plugin (But this is manual)

Script wise, you can do the following:

  1. Get all the child pages with the REST API: Make a GET call to

    https://confluence-domain.com/rest/api/content/search?cql=parent={Parent Page-id}

This will return a "results" array with info about the child pages. Parse out the "id" fields. (Hint: if you are using bash, you can use the beautiful jq library https://stedolan.github.io/jq/

  1. Once you have the child page IDs, you can export each individually to PDF using:

    wget https://confluence-domain.com/spaces/flyingpdf/pdfpageexport.action?pageId=xxxx -O mypage.pdf
    

This blog might help you in your coding: http://javamemento.blogspot.no/2016/05/jira-confluence-3.html




回答2:


Go to the Space directory, find the relevant space and click the (i) icon there to get to the space details page. From there, click either Space Operations/PDF Export, or Content Tools/Export, then choose Custom Export. You’ll be able to select the list of pages to be exported. (All pages under a given page can be selected by clicking Deselect All and then clicking the checkbox for the parent page. All child pages will be selected automatically.)



来源:https://stackoverflow.com/questions/37912885/how-do-i-export-all-pages-below-a-page-in-confluence-using-a-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!