Hi Team,
I am trying to upload small size txt file into a Jira Server Issue and below is the python script I am trying to execute.
# ===============
# upload.attachment.py
# ===============
import requests
import json
# [JIRA-BASE-URL], i.e.: http://localhost:8080
# [ISSUE-ID], i.e.: ATT-1
url = '[mycompcorpjiraurl]/jira/rest/api/latest/issue/[issueID]'
headers = {"X-Atlassian-Token": "nocheck"}
# please uncomment to attach external file
files = {'file': open('greetings.txt', 'rb')}
# upload file to issue
r = requests.post(url, auth=('mycompanycorpjiraloginuser', 'mycompanycorpjiraloginpwd'), files=files, headers=headers)
print(r.status_code)
print(r.text)
Response:
500
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>500 Internal Server Error</title>
</head><body>
<h1>Internal Server Error</h1>
<p>The server encountered an unknown error</p>
</body></html>
I had tried java script for which same response is returned. I do not have admin rights to view the logs. Please help.
I think you already forgot the "/attachments" part in your URL ?
For other users that might encounter this error when using REST, check out the reference guide for this endpoint in
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Validate your expertise in managing Jira Service Projects for Cloud. Master configuration, optimize workflows, and manage users seamlessly. Earn global 🗺️ recognition and advance your career as a trusted Jira Service management expert.
Get Certified! ✍️Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.