Forums

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

Cannot POST temporaryAttachments

Myles.Popa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 15, 2020

So I am trying to POST to the:

servicedeskapi/servicedesk/{serviceDeskId}/attachTemporaryFile

endpoint with the purposes of then attaching a document to a service request via a python code.  I can do all sorts of other things like get ticket information, download attachments, and post a comment through the APIs using python.  I am using these headers:

headers = {
'Accept': 'application/json',
"Authorization": "Basic {my-authorization}",
'Content-type': 'application/json'
}

However when I hit the attachTemporaryFile endpoint I am getting this error:

{'errorMessage': 'The action performed required a logged in user. Please log in and try again.',
 'i18nErrorMessage': {'i18nKey': 'sd.admin.servicedesk.error.authenticated.user.required',
  'parameters': []}}

Which is weird because I am the admin.  I have also tried defining  "X-Atlassian-Token: no-check" in the headers as others have suggested.  What am I doing wrong?  Is there a way to attach a file directly to a request?  

-Thanks

1 answer

0 votes
Gonchik Tsymzhitov
Community Champion
February 11, 2021

Hi! 

I do recommend you just keep session, you can do it via request.Session()

like that one

https://github.com/atlassian-api/atlassian-python-api/blob/master/atlassian/service_desk.py#L460

Suggest an answer

Log in or Sign up to answer