I am trying to create a new element (“model-3d”) AND upload a file with it at the same time. I keep getting the error:
error: Cannot destructure property 'data' of 'parseBody(...)' as it is undefined.
But I am specifying the data field in Python requests? How do I specify the field in the model-3d element to upload to?
headers = {
'Authorization': f"Bearer {jwt}",
}
url = f"{strapi_server_url}/api/model-3ds"
filename = "AAS-SGC-TMW-NIO.stl"
file={'files.model-3d.stl': (filename, open(Path(os.getcwd(), filename), 'rb'), 'application/octet-stream') }
data = {
'data' : {
'seed': filename,
'submit': 'Submit',
}
}
response = requests.post(url, files=file, data=data, headers=headers)
System Information
- Strapi Version: 4.0.7
- Operating System: Ubuntu 20.04.3 LTS
- Database: PG 13.4
- Node Version: v12.22.7
- NPM Version: 6.14.15
- Yarn Version: 1.22.17