Hi,
i try to upload an image via api call.
Create a media object in shopware in the right mediafolder
POST /api/v3/media
payload:{„mediaFolderId“:„00d649bbe5a9477fa975ad33273246ed“,„id“:„ec90cae2cc84c37b6b7a0cb9fe5c4548“}
works fine!
Upload the new image (testfile.png) via url
POST /api/v3/_action/media/ec90cae2cc84c37b6b7a0cb9fe5c4548/upload?extension=png&fileName=testfile
payload: {„url“:„http://…/testfile.png“}
a file is created, but the content of the file is not the png image but the payload string.
any Ideas?
trade
15. Mai 2021 um 18:19
2
Where is your image file located? Upload with url is not possible from a remote host, as far as I know. It has to be on the same server.
The image is located on an other public internet Server, uploading the same image in the shopware backend works fine.
just tested: image url on the same server also doesn’t work
trade
16. Mai 2021 um 08:03
4
I‘m sending not the url but the data of the image. First create the media object as you did and then uploading data. There are a few threads about this here in the german forum.