Does anyone have any functional examples of using the wix-stores-backend addProductMedia method. Here for me it always returns internal server error
What code have you used for this?
Is it just the code from the Wix Stores Backend API and the addProductMedia function itself?
https://www.wix.com/corvid/reference/wix-stores-backend.html#addProductMedia
As for the internal server error, is it this one as shown here?
https://support.wix.com/en/article/live-site-error-error-500-internal-server-error
Yes, I only used the media API code … the intention is to add images to the product created via code …
Hi, I want to implement the same as you. Have you get any help from the community? I get internal server error every time I call the API.
Hi,
i cant upload image media when using the upload button
maybe its due to all upload button images uploading to “Visitor Upload” folder in the media app
and on this folder the copy URL dos not work - so there is no external URL
but the addProductMedia() API should work with internal URLs and it dos not
example code:
FrontEnd:
import { mediaNewProductBackendFunction } from'backend/addProducts';
export function uploadButton_change(event) {
$w("#uploadButton").startUpload()
.then((uploadedFile) => {
let url = uploadedFile.url;
let data=[{url}]
let productId="YOUR PRODUCT ID"
mediaNewProductBackendFunction(productId,data)
})
}
BackEnd Code: addProducts.jsw
import wixStoresBackend from 'wix-stores-backend';
export function mediaNewProductBackendFunction(productId, data) {
return wixStoresBackend.addProductMedia(productId, data);
}
please help if you know who can fix it
or if you know other way to upload image and addProductMedia() API with code
i already try with Wix support but with no luck
I used to be able to use this function succesfully, but now it is giving me intellisense warning about the Media type having to have properties choice and even id and url, which are deprecated according to the docs…(??)
The only error details I’m getting back now is
“[”{"errorCode":-100,"errorDescription":"Internal Server Error [request-id: 14948692-2853-4310-85d8-697f62064127]","success":false,"payload":null,"errorGroup":"User"}“]”
Are there breaking changes to this function?