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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.