Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How should I create page with markdown content by using REST API ?

chengjingtao November 21, 2019

HI, I want  to sync my docs into  Confluence server and all docs are written by markdown . I install a markdown plugin named bobswift-markdown on Confluence

I plan to develop a script tool and create page by invoking Confluence REST API .

 

I have read the doc https://developer.atlassian.com/server/confluence/confluence-rest-api-examples/  and the doc https://docs.atlassian.com/ConfluenceServer/rest/7.1.0.

But I still don't know how to create a page with markdown content .

Is there any documents or examples ?

3 answers

1 accepted

0 votes
Answer accepted
Yoga Reddy {Appfire}
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.
November 26, 2019

Hi @chengjingtao 

Hope you are doing good.

We have tested your requirement internally which you want to update/create a page with the Markdown content document into confluence. This can be achieved by using Confluence Command Line Interface(CLI) app.
https://marketplace.atlassian.com/apps/284/confluence-command-line-interface-cli?hosting=cloud&tab=overview.

Here is the examples page for run the actions.
https://bobswift.atlassian.net/wiki/spaces/CSOAP/pages/10584066/Examples

Run the following command to copy the documents from your local system to Confluence.

{code}
--action storePage --space "zclimarkdown" --title "markdown readme with toc" --parent "@home" --file "./src/itest/confluence/resources/readme-flexmark.markdown" --markdown
{code}

Please let us know if you need any further assistance.

Thanks

Yoga

chengjingtao November 26, 2019

Thanks for your reply.

I have tried `Confluence Command Line Interface (CLI) app` and it works well when use action of storePage.

And I have also tried action of loadFiles.

But I am confusing about that how should I specify `mime`.  Becuase CLI always treat my `.md` file as attachments.  It cannot works well with options `--mime text/markdown`.

Yoga Reddy {Appfire}
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.
November 27, 2019

Hi @chengjingtao 

Normally, Markdown files must have the right mime type set to work correctly.

Are you running the CLI command as below (md files will copy the contents of the file and store as the contents in the page)
--action storePage --space "zmarkdown" --title "markdown" --parent "@home" --file "README.md" --markdown
Can you confirm if all your files are with extensions, md?

Thanks

Yoga

Yoga Reddy {Appfire}
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.
December 1, 2019

Hi @chengjingtao 

Hope you are doing great!

As we didn't get any response from you and there is no outstanding activity on this ticket, we are marking this support ticket as resolved for now.

Please feel free to reopen or add a comment to this ticket if desired, or open a new ticket. We will be happy to reconnect with you!

Thank you!
Yoga

chengjingtao December 2, 2019

OK.

I am sorry to reply so late.

My original problem has been resolved, you could mark this support ticket as resolved.

I will open a new ticket for my new problem, Thanks again.

Yoga Reddy {Appfire}
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.
December 2, 2019

Thank you for your reply and please report any Bobshwift related issue via https://bobswift.atlassian.net/ and Wittified related issues via https://wittified.atlassian.net/

Thanks

Yoga

0 votes
Yoga Reddy {Appfire}
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.
November 27, 2019

.

0 votes
Yoga Reddy {Appfire}
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.
November 22, 2019

Hi @chengjingtao 

Markdown for Confluence provides macros that render Markdown content on Confluence pages. The content can be entered directly in the body of a the markdown macro or be from an attachment or url. Markdown content is processed using flexmark which supports a version of the Markdown language with many popular extensions including Github-flavored-Markdown (GFM), PHP Markdown Extra, and wiki links.
Its features include Render Markdown content on Confluence pages, Pull-in Markdown content from multiple sources and Easily link to other pages with WikiLinks.

You can review the documentation on the below links.
https://bobswift.atlassian.net/wiki/spaces/MARKDOWN/overview
https://bobswift.atlassian.net/wiki/spaces/MARKDOWN/pages/41976045/User+s+Guide
We are sorry to inform you that the behavior of our app is not meant to be used with the REST API.

Thanks
Yoga

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events