vienthuong / shopware-php-sdk

A PHP SDK for Shopware 6 Admin API
MIT License
112 stars 44 forks source link

Support uploading media as binary #39

Closed mschop closed 2 years ago

mschop commented 2 years ago

Hi,

currently it is not possible to use the AdminActionService for uploading media as binary. Only url based upload is supported.

See: https://shopware.stoplight.io/docs/admin-api/ZG9jOjEyNjI1Mzkw-media-handling#upload-the-resource-directly

Expected available API:

(new AdminActionService($context))->execute('POST', "media/$mediaId/upload", $imageAsBinary);

But only this works:

(new AdminActionService($context))->execute('POST', "media/$mediaId/upload", ['url' => 'https://something/image.jpg']);

Best Regards

vienthuong commented 2 years ago

I updated it in the lastest version, feel free to reopen ticket if you have any issue And also I added a new MediaService, now you can use the MediaService instead https://github.com/vienthuong/shopware-php-sdk/pull/44