Appearance
Images Webhook Notification
The Images Webhook Notification from MyLION provides you with updates about changes in product images. Below, you'll find details about the payload structure of the notification and how to set up your receiving endpoint to process these image updates. Note: You should replace the images for the given product in your system with the images in the update.
Payload Structure
When an image update event occurs within the MyLION ERP system, a webhook notification is sent to your designated endpoint. The payload of this notification follows this structure:
json
{
"products": [
{
"id": {
"myLionId": 12345678,
"externalId": "extId",
},
"active": true,
"images": [
{
"fileName": "product_image.jpg",
"imageValueInBase64": "base64-encoded-image-data",
"fileUrl": "https://example.com/images/product_image.jpg",
"isDefaultPicture": true
}
]
}
]
}images: An array of image updates.myLionId: The unique identifier of the product within MyLION.externalId: Your external identifier for the product.- 'images': An array of images for the product.
- 'fileName': The file name of the image.
- 'fileUrl': The URL of the image if points to an external image. Will be only filled if the image is not uploaded to MyLION.
- 'imageValueInBase64': The base64 encoded image data. Will be only filled if the file url is not present.
- 'isDefaultPicture': Whether the image is the default image for the product.
Receiving Endpoint
To process the Images Webhook Notification from MyLION, you need to set up a receiving endpoint in your application. The endpoint URL should follow this format:
bash
https://<your_base_url>/rest/mylion/v1/product-imagesWhen MyLION sends a webhook notification, it will make a POST request to the specified endpoint with the payload containing the updated images. The expected response is HTTP OK (200), no payload.
Processing the Notification
Upon receiving the webhook notification, you can process the payload to update the specific product images in your application's database or system. You should validate the authenticity of the incoming request using the webhook authentication method previously outlined to ensure the data's integrity.