Is there a way to "inject" a file inside Jira forms?

John Reign Encina October 24, 2024

Hello!

As mentioned in the question above, is there a way to insert a file inside of a Jira forms (with attachment field)?

I believe it should use multiple Jira REST APIs, but I'm not sure which APIs should I use.

Thanks!

2 answers

0 votes
Olha Yevdokymova_SaaSJet
Atlassian Partner
October 31, 2024

Hello!

To address your question, while native Jira forms have limitations with file handling, Smart Forms for Jira provides enhanced options that could meet your needs. With Smart Forms for Jira, you can add an attachment field within the form, allowing users to upload files directly, just like an attachment in Jira issues.

Additionally, Smart Forms for Jira supports embedded content, so you can insert files (like PDFs or documents from accessible online drives) directly into the form itself, making them readable and accessible to users as part of the form content.Screenshot 2024-10-31 at 21.15.47.png

This approach combines the benefits of attachments and embedded resources, providing flexibility within Jira forms. If you’re interested, you can find more details on Smart Forms for Jira in the Atlassian Marketplace here.

Let me know if this helps or if you have other questions!

0 votes
Mikel Garcia Bartolome
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.
October 25, 2024

Hey, you can add attachments to a Jira form (like a ticket) using the Jira REST API. You’ll typically need to use two endpoints:

  1. Create the Issue (optional): If you’re creating a new issue with the form, you’ll start by using the POST /rest/api/3/issue endpoint to create the issue itself.
  2. Add Attachment to the Issue: Once you have the issue created (or if you already have an existing issue), you can use the POST /rest/api/3/issue/{issueIdOrKey}/attachments endpoint to add attachments to it.

Step 1: Create Issue

To create a new issue, use:

POST /rest/api/3/issue

Content-Type: application/json

Authorization: Bearer <your_token>

Sample Payload

{

"fields": {

"project": { "key": "PROJ" },

"summary": "New Issue with Attachment",

"issuetype": { "name": "Task" }

}

}

This will return an issueId that you’ll use in the next step.

Step 2: Attach the file

To attach a file, use the POST /rest/api/3/issue/{issueIdOrKey}/attachments endpoint.

POST /rest/api/3/issue/{issueIdOrKey}/attachments

X-Atlassian-Token: no-check

Authorization: Bearer <your_token>

Sample Payload

In this case, you’ll need to set up a multipart/form-data request to send the file:


curl -D- -u <email>:<api_token> -X POST -H "X-Atlassian-Token: no-check" -F "file=@/path/to/file" "https://your-domain.atlassian.net/rest/api/3/issue/{issueIdOrKey}/attachments"

Replace /path/to/file with the file path, and {issueIdOrKey} with the ID or key of the issue.

John Reign Encina October 27, 2024

Hello!

I tried this method, but the result is not what I expect.

Untitled.png

As you can see in the image above, this is my goal. Is that possible? Or am I missed something?

Thanks! ^^

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events