How can I upload one or more images using the API?
I tried with this, taken from the documentation:
import requests
url = "http://localhost:2283/api/asset/upload"
payload = {}
files=[
('assetData',('file',open('../images/1.jpg','rb'),'image/jpeg'))
]
headers = {
'Content-Type': 'multipart/form-data',
'Accept': 'application/json',
'x-api-key': 'placeholder-api-key'
}
response = requests.request("POST", url, headers=headers, data=payload, files=files)
print(response.text)
However, I am getting the following error:
{"message":"Multipart: Boundary not found", "error":"Bad request","statusCode":400}
.