Getting 500 internal server error when trying to upload attachment in JIRA.Please guide

Divya Srinivasan January 2, 2019

Hi Team,

 I am trying to upload small size txt file into JIRA 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, possibly due to misconfiguration.
Contact the server administrator: [no address given]<p>
More information about this error may be available
in the server error log.</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.

 

2 answers

1 accepted

1 vote
Answer accepted
Marc Minten _EVS_
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.
January 2, 2019

I think you already forgot the "/attachments" part in your URL ?

CARLISLE
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.
January 3, 2019

This missing thing is irrelevant I believe because it more than likely is a configuration error on the server side.

Like eldar.sharipov likes this
0 votes
CARLISLE
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.
January 2, 2019

This error is a server side HTTP status code. 500 and 400s are the most common network errors to return.

The server encountered an unexpected condition which prevented it from fulfilling the request.
Wikipedia

A generic error message, given when no more specific message is suitable.

The general catch-all error when the server-side throws an exception

5xx server side

4xx client side

https://restapitutorial.com/httpstatuscodes.html

I would check with your networking team on that one.

Suggest an answer

Log in or Sign up to answer