I'm having a few issues with Jira Forms, but it mainly results in not being able to get the form data in a presentable format. This is going to be a long post because of the examples and screenshots. but I'll summarize quickly:
First, the example text. Notice that when presented in the interface, this information respects words when wrapping and includes all formatting. The form has one Paragraph form field and I've added the following example text:
Lorem ipsum dolor sit amet, BOLD TEXT: consectetuer adipiscing elit. Aenean commodo ligula eget dolor. Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. ITALIC TEXT: Donec quam felis, ultricies nec, pellentesque eu, pretium quis, sem. Nulla consequat massa quis enim. STRIKETHROUGH TEXT Donec pede justo, fringilla vel, aliquet nec, vulputate eget, arcu. In enim justo, rhoncus ut, imperdiet a, venenatis vitae, justo.
Nullam dictum felis eu pede mollis pretium. Integer tincidunt. Cras dapibus. Vivamus elementum semper nisi. Aenean vulputate eleifend tellus. Aenean leo ligula, porttitor eu, consequat vitae, eleifend ac, enim. Aliquam lorem ante, dapibus in, viverra quis, feugiat a, tellus. Phasellus viverra nulla ut metus varius laoreet. Quisque rutrum.
Bullet List
Item 1
Item 2
Item 3
Numbered List
Item 1
Item 2
Item 3
Now, here is a screenshot of that form's PDF export:
Ok, so the PDF formatting is terrible and for the link, useless because it doesn't actually create a hyperlink or show the URL. The next thing I tried was the XLSX export thinking that it'd have the data in some format like Markdown.
Note: This isn't included in this example, but another quirk I found while testing is that attachments on a form are displayed as a UUID string with no filename, link, or context.
This was even worse. Not only did it not show the URL for the link, but it also did not present any of the formatting. I realize that adding text formatting to cell is likely pretty complicated, but if this were at least in Markdown I could copy and paste it into a Markdown view and get the formatted data. With the XLSX, any formatting other than lists is completely lost.
Ok, so if the PDF and XLSX are unusable, surely there is an API that I can use to get all of the information and then I can do whatever I want with it right? Wrong.
https://developer.atlassian.com/cloud/forms/rest/api-group-forms-on-issue/#api-group-forms-on-issue
My options for getting the form data are either:
The only method for getting the complete form data is via the Get Form API and this includes the data in the Atlassian Document Format which is cumbersome because there are no built-in parsers for it and Atlassian doesn't provide an API for converting ADF to HTML or Markdown.
Hey @Monty - I came here from your comment on JRACLOUD-77436. I wonder if you happened to see my comment from the end of December.
I don't know if you have a Confluence site handy (but it might be worth spinning up a free one for this), but Confluence has conversion endpoint: Asynchronously convert content body
It supports these conversions:
I fed it the ADF of one of my Jira comments that included a table with a merged cell, requested styled_view, and got back very nice HTML, with the merged cell intact.
So if you are going to the trouble of grabbing ADF, this endpoint might give you a way to then convert it into HTML.
My company has some ancient stigma around using Confluence so it's a non-starter, but I may test this with my own sandbox instance. Thanks for reaching out - this is the sort of thing I've been looking for!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmmm.. I am having a bit of trouble with getting this to work.
The example they use is:
curl --request POST \
--url 'https://your-domain.atlassian.net/wiki/rest/api/contentbody/convert/async/{to}' \
--user 'email@example.com:<api_token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{ "value": "<string>", "representation": "view" }'
Path parameters
string
Required
The name of the target format for the content body.
Valid values: export_view
So even if I'm using `styled_view` for the representation string in the body, the URL is still:
https://your-domain.atlassian.net/wiki/rest/api/contentbody/convert/async/export_view
Is that right?
The content body to convert.
string
Required
The body of the content in the relevant format.
string
Required
The content format type. Set the value of this property to the name of the format being used, e.g. 'storage'.
Valid values: view, export_view, styled_view, storage, editor, editor2, anonymous_export_view, wiki, atlas_doc_format, plain, raw .
So my body looks like this:
{
"representation": "styled_view",
"value": "{ \"version\": 1, \"type\": \"doc\", \"content\": [ { \"type\": \"heading\", \"attrs\": { \"level\": 1 }, \"content\": [ { \"type\": \"text\", \"text\": \"Heading 1\" } ] }, {
\"type\": \"paragraph\", \"content\": [ { \"type\": \"text\", \"text\": \"Lorem ipsum dolor sit amet, BOLD TEXT: \"
...
...
}
But I'm getting: The remote server returned an error: (400) Bad Request.
I tried giving adding the ADF document to the value parameter as JSON, but it didn't like that either.
I passed the ADF to the https://developer.atlassian.com/cloud/jira/platform/apis/document/viewer/ to validate it and it looks fine. Not sure exactly what I'm doing wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here is a link to the ADF document:
https://pastecode.io/s/es30o5zf
Here is my Body JSON with the value parameter as a string:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
AHA! Never mind, I figured it out after reading https://developer.atlassian.com/platform/forge/using-rich-text-bodied-macros/
The API documentation confused me because it said the only valid value of the {to} parameter was 'export_view' so I assumed that was the only value. Then for representation, I thought this was how to select what format you wanted returned, not the type of document that you are sending to the API.
Once I reversed those, it worked great. THANK YOU!
Now, if only they could add this (or similar) endpoint to the Jira Cloud Platform API or provide it's own separate documentation like they did with the Jira Forms API, it'd be more universally available for folks without relying on Confluence.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.