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

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

Is there documentation for api.atlassian.com/pf-editor-service/convert?

I discovered the api https://api.atlassian.com/pf-editor-service/convert?from=markdown&to=adf 
for converting markdown to Atlassian Document Format used extensively in V3 of the jira api. 

I would like to know if the api can convert to other formats such as text and html.

2 answers

Hello @Lars Norved 

How did you 'discover' that endpoint for that service? Where was it discussed or disclosed? I'm very keen to know more about it.

I've just been playing with sending POST requests to the endpoint and it definitely does convert markdown to ADF, as I sent a bunch of markdown and got ADF back. The method of supplying the content is via a field called 'input' in the body of the request:

{

     "input""# This is an H1.\nThis is _italic_ and this is **bold** in markdown"

}

While experimenting with different from= values, I then got it to throw an error:

"error": "from should be equal to one of the allowed values: markdown, adf, html, text, wiki, pm"

So, looks like it can convert five different formats to ADF, or so it says.

However, when I tried:

https://api.atlassian.com/pf-editor-service/convert?from=html&to=adf

I got back:

"message""Cannot convert from 'html' to 'adf'"

So, the endpoint is still in some sort of experimental / incomplete state, or only converts certain types to certain other types.

.... more experiments are in progress :)

Here is a table of the formats that the endpoint will convert from and to:

Annotation 2021-07-09 181128.png

I found that:

  1. 'markdown' means Jira markup encoded text.
  2. 'wiki' means Confluence markup encoded text.
  3. 'pm' means Page Markup, and essentially seems to be another name for ADF.

When supplying ADF content in the input of the request body, you have to use the full ADF format  like this:

{
"input": {
    "version": 1,
    "type": "doc",
    "content": [
        {
            "type": "heading",
            "attrs": {
                "level": 1
            },
            "content": [
                {
                    "type": "text",
                    "text": "This is an H1."
                }
            ]
        },
        {
            "type": "paragraph",
            "content": [
                {
                    "type": "text",
                    "text": "This is "
                },
                {
                    "type": "text",
                    "text": "italic",
                    "marks": [
                        {
                            "type": "em"
                        }
                    ]
                },
                {
                    "type": "text",
                    "text": " and this is "
                },
                {
                    "type": "text",
                    "text": "bold",
                    "marks": [
                        {
                            "type": "strong"
                        }
                    ]
                },
                {
                    "type": "text",
                    "text": " in markdown"
                }
            ]
        }
    ]
}
}

Enjoy :)

Suggest an answer

Log in or Sign up to answer
TAGS

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