Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Attach Files to a Form

Gustavo Marques da Silva
March 2, 2026

Hello everyone!

I'm trying to automate an issue opening through python using the Jira APIs.

The issue which I'm trying to open has a form inside it.

I'm getting successful in upload a file to an issue, but when I try to "link" the attachment into the form field for attachment, I keep receiving an "failed to upload" in the screen :(

The flow I'm following: Open an issue, add a blank form to the issue, add a file to the issue, answer the form.


def uploadFilesToIssue(ISSUE_KEY):
url = f"{JIRA_URL}/rest/api/3/issue/{ISSUE_KEY}/attachments"
files = {
"file": open("teste_anexo.xlsx", "rb")
}
headers_anexo = {
"Accept": "application/json",
"X-Atlassian-Token": "no-check"
}
response = requests.post(
url,
headers=headers_anexo,
auth=auth,
files=files
)
if response.status_code == 200:
js_attachments = response.json()
else:
js_attachments = {}
print(f"Erro na função GetAssetsObjectsListByAQL - {response.status_code}, {response.text}")
return js_attachments

 

It works well!

js_attachments = uploadFilesToIssue(ISSUE_KEY)
file = js_attachments[0]
iso_date = file.get("created")
dt = datetime.strptime(iso_date, "%Y-%m-%dT%H:%M:%S.%f%z")
creation_unix = int(dt.timestamp())
answer = {
"files": [
{
"id": file.get("id"),
"name": file.get("filename"),
"size": file.get("size"),
"type": file.get("mimeType", ""),
"creationDate": creation_unix
}
]
}

It passes, but in the web portal, when I see the form on the issue, the error "failed to upload"

2 answers

0 votes
Joseph Chung Yin
Community Champion
March 2, 2026

@Gustavo Marques da Silva -

Are you saying that via your API solution, it works successfully with Form and attachment.  However, if someone goes to the portal UI using Forms to create issue, then the operation fails when trying to add the attachment?

Please advise.

Best, Joseph Chung Yin

Gustavo Marques da Silva
March 3, 2026

Hello Joseph. No haha

Via my API solution, it works successfully with the Form and the attachment - the file is correctly associated.

However, when the solving team's partner goes to the portal UI and sees the issue through Forms, they are not able to see the attachment inside the specific form field. The attachment appears only at the issue level.

This can be confusing because the file is technically added to the issue, but it is not displayed within the corresponding field in the form itself.

0 votes
Benjamin
Community Champion
March 2, 2026

Hi @Gustavo Marques da Silva ,

 

The one thing I can think of is there a possible permission issue. Have you tried uploading manually with the same user that is use to action the automation action?

Gustavo Marques da Silva
March 2, 2026

Great observation, I just tried to upload it through the web portal, and I have no problems with it.

I saw through F12 (dev Tools) that the front is calling an endpoint called "https://api.media.atlassian.com/upload/createWithFiles?hashAlgorithm=sha256"

And then "https://{JIRA_URL}/rest/servicedesk/1/customer/portal/{SERVICE_DESK_ID}/media/upload"

Benjamin
Community Champion
March 4, 2026

It looks ok as long as the Jira URL and service ID is correct. Any specific errors pop up on dev tools?

Suggest an answer

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

Atlassian Community Events