Skip to content

Commit e988a50

Browse files
authored
[Jira Service management] Update service_desk.py (#691)
* Update service_desk.py with the default 'application/json' content-type the upload is not working in the documentation there is a hint which headers should be set if the X-Atlassian-Token is missing you receive a 404 * Update service_desk.py * Update service_desk.py
1 parent 10ed81b commit e988a50

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

atlassian/service_desk.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,14 @@ def attach_temporary_file(self, service_desk_id, filename):
466466
"""
467467
url = "rest/servicedeskapi/servicedesk/{}/attachTemporaryFile".format(service_desk_id)
468468

469+
# no application/json content type and an additional X-Atlassian-Token header
470+
# https://docs.atlassian.com/jira-servicedesk/REST/4.14.1/#servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile-attachTemporaryFile
471+
experimental_headers = self.experimental_headers.copy()
472+
del experimental_headers["Content-Type"]
473+
experimental_headers["X-Atlassian-Token"] = "no-check"
474+
469475
with open(filename, "rb") as file:
470-
result = self.post(path=url, headers=self.experimental_headers, files={"file": file}).get(
471-
"temporaryAttachments"
472-
)
476+
result = self.post(path=url, headers=experimental_headers, files={"file": file}).get("temporaryAttachments")
473477
temp_attachment_id = result[0].get("temporaryAttachmentId")
474478

475479
return temp_attachment_id

0 commit comments

Comments
 (0)