Question
Update dynamic image content by API
Hi, I have a few questions regarding modification dynamic image content in emails by Rest API. Generally I need update alternative text, but to update just this property, it is neccessary provide request with all content arguments (image url, alt text, with, style...). See issues bellow.
1. Sometimes it is not possible to update image due to Invalid URL error. See for example image content bellow (dynamic image content):
GET /rest/asset/v1/email/1717/dynamicContent/RVMtc2luZ2xl.jsonResponse:
[
{
"createdAt": "2022-04-06T14:47:45Z+0000",
"updatedAt": "2022-04-06T14:47:45Z+0000",
"id": 1717,
"segmentation": 1011,
"content": [
{
"id": "MTMzMg**",
"segmentId": 1041,
"segmentName": "Default",
"content": "https://via.placeholder.com/1200x400",
"type": "Image",
"width": "600",
"altText": "MULTIPLE.PNG",
"linkUrl": "https://via.placeholder.com/1200x400",
"style": "-ms-interpolation-mode: bicubic; outline: none; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; text-decoration: none; border-top-width: 0; display: block; max-width: 100%; line-height: 100%; height: auto; width: 600px"
},
...
]
}
]And if I try to update segment by API with the same url that was configured in UI, it fails. This happens only for some URLs. See request and response bellow.
POST /rest/asset/v1/email/1717/dynamicContent/RVMtc2luZ2xl.json
Body: segment=Default&type=Image&externalUrl=https://via.placeholder.com/1200x400&altText=updated-alt-textResponse:
{
"success": false,
"errors": [
{
"message": "Invalid URL",
"code": "701"
}
],
"requestId": "11ea3#18008f813ba",
"warnings": []
}Are there any restrictions in url validation? Why modification in UI works but it fails for API call?
2. Is it possible somehow update segmented image content of File type (image uploaded from my computer)?
See dynamic image content bellow:
GET /rest/asset/v1/email/1717/dynamicContent/RVMtYXJ0aWNsZTQ=.json
[
{
"createdAt": "2022-04-08T11:53:10Z+0000",
"updatedAt": "2022-04-08T11:53:10Z+0000",
"id": 1717,
"segmentation": 1011,
"content": [
{
"id": "MTM0NQ**",
"segmentId": 1041,
"segmentName": "Default",
"content": "5396",
"type": "File",
"contentUrl": "http://063-RVK-838.mktoweb.com/rs/063-RVK-838/images/marketo-image-from-computer.png",
"height": "auto",
"width": "270",
"altText": "marketo-image-from-computer.png",
"style": ""
}
]
}
]
I tried the following API request, but it fails with `Invalid data for Type.` message.
POST /rest/asset/v1/email/1717/dynamicContent/RVMtc2luZ2xl.json
Body: segment=Default&type=File&contentUrl=http://063-RVK-838.mktoweb.com/rs/063-RVK-838/images/marketo-image-from-computer.png&altText=updated-alt-textResponse:
{
"success": false,
"errors": [
{
"message": "Invalid data for Type.",
"code": "701"
}
],
"requestId": "4724#1800912a367",
"warnings": []
}
3. Is it possible detect by API call that segmented image has locked size? The issue is that I want to change dynamic image content but I don't know whether image size is locked or not, so if size is locked and image width is provided in update request it fails with `Error processing Image: Image size is locked in email template. Cannot edit image size`. This error occurs even if file size is not changed.
GET /rest/asset/v1/email/1717/dynamicContent/RVMtc2luZ2xl.json
Response:
[
{
"createdAt": "2022-04-06T14:47:45Z+0000",
"updatedAt": "2022-04-06T14:47:45Z+0000",
"id": 1717,
"segmentation": 1011,
"content": [
{
"id": "MTMzMg**",
"segmentId": 1041,
"segmentName": "Default",
"content": "https://via.placeholder.com/1200x400",
"type": "Image",
"width": "600",
"altText": "MULTIPLE.PNG",
"linkUrl": "https://via.placeholder.com/1200x400",
"style": "-ms-interpolation-mode: bicubic; outline: none; border-right-width: 0; border-bottom-width: 0; border-left-width: 0; text-decoration: none; border-top-width: 0; display: block; max-width: 100%; line-height: 100%; height: auto; width: 600px"
},
...
]
}
]And modification request:
POST /rest/asset/v1/email/1717/dynamicContent/RVMtc2luZ2xl.json
Body: segment=Default&type=Image&externalUrl=https://placekitten.com/200/300&a&altText=updated-alt-text&width=600Response:
{
"requestId": "4a3e#18009178a1c",
"success": false,
"warnings": [],
"errors": [
{
"code": "611",
"message": "Error processing Image: Image size is locked in email template. Cannot edit image size"
}
]
}Thanks a lot