Hello,
I try to use the api v1 with python request to upload file. Here is my code:
base_url = f'https://{self._domain}/wiki/rest/api/content'
url = f'{base_url}/{id}/child/attachment'
headers = {
"Accept": "application/json",
'X-Atlassian-Token': 'nocheck'
}
file_name = os.path.basename(file)
content_type = self.content_types.get(os.path.splitext(file_name)[1], "application/binary")
with open(file, "rb") as fd:
content = fd.read()
files_data = {
'file': (file_name, content, content_type)
}
params = {}
if minor_edit:
minor_edit = 'true'
else:
minor_edit = 'false'
data = {
'file': file_name,
'minorEdit': minor_edit,
}
if comment:
data['comment'] = comment
response = self.put(url, params=params, data=data, files=files_data, headers=headers)
It return me each time a error 415:
requests.exceptions.HTTPError: 415 Client Error: Unsupported Media Type for url
Do you have from where it can came from?
Thanks in advance
Pierrick