Morten
12/12/2024, 11:58 AMurl
property, but in the Backoffice API, I only get the mediaKey
. Is there a way to get the full image URL from the Backoffice API? Do I need to make an additional call to some dictionary or service?
Here are the two different responses for comparison:
Content Delivery API response:
json
{
"image": [{
"bytes": 9583,
"crops": [],
"extension": "png",
"focalPoint": null,
"height": 155,
"id": "d789d27b-e906-4b3b-b82e-2eb023722eb1",
"mediaType": "Image",
"name": "Ico 1",
"properties": {},
"url": "/media/pxjitvyg/ico_1.png",
"width": 152
}]
}
Backoffice API response:
json
{
"contentTypeKey": "8c650da5-2282-4f8b-a656-74583a99b878",
"key": "f9025e08-80d3-4208-a35e-cdea8afe89c9",
"udi": null,
"values": [{
"alias": "image",
"culture": null,
"editorAlias": "Umbraco.MediaPicker3",
"segment": null,
"value": [{
"crops": [],
"focalPoint": null,
"key": "141855ed-12bd-445d-820f-5dc247978a10",
"mediaKey": "d789d27b-e906-4b3b-b82e-2eb023722eb1",
"mediaTypeAlias": "Image"
}]
}]
}
Any guidance would be appreciated!Sven Geusens
12/13/2024, 8:59 AMvalues[].value.mediaKey
and pass that into /umbraco/management/api/v1/media/{key}
you will get something like this
{
"urls": [
{
"culture": null,
"url": "https://localhost:44339/media/tidd55i2/creative-technology-showreel-241274.mp3"
}
],
"isTrashed": false,
"mediaType": {
"id": "4c52d8ab-54e6-40cd-999c-7a5f24903e4d",
"icon": "icon-document",
"collection": null
},
"id": "5dd46f69-893b-49e5-b871-95ad86573c0c",
"values": [
{
"editorAlias": "Umbraco.UploadField",
"culture": null,
"segment": null,
"alias": "umbracoFile",
"value": {
"src": "/media/tidd55i2/creative-technology-showreel-241274.mp3"
}
},
{
"editorAlias": "Umbraco.Label",
"culture": null,
"segment": null,
"alias": "umbracoExtension",
"value": "mp3"
},
{
"editorAlias": "Umbraco.Label",
"culture": null,
"segment": null,
"alias": "umbracoBytes",
"value": "3535934"
}
],
"variants": [
{
"createDate": "2024-10-02T09:08:30.709983+02:00",
"updateDate": "2024-10-02T09:08:30.709983+02:00",
"culture": null,
"segment": null,
"name": "creative-technology-showreel-241274.mp3"
}
]
}
You can then get the urls from it's response in urls.url
do note that this is the uncropped version, so if you have crops defined on the media item (second request) or on the picker (first request) you will have to add them to the url yourself.Steffen Nielsen
12/13/2024, 9:35 AMSven Geusens
12/13/2024, 11:21 AMSven Geusens
12/13/2024, 11:21 AMSven Geusens
12/13/2024, 11:24 AMJacob Overgaard
12/13/2024, 1:01 PMid
, width
, height
, and mode
.
Id = guid
Width & height = pixel value
Mode = crop or one of the other Image Sharp valuesJacob Overgaard
12/13/2024, 1:02 PMhtml
<umb-imaging-thumbnail unique="GUID" width="300" height="300" mode="crop"></umb-imaging-thumbnail>
Jacob Overgaard
12/13/2024, 1:03 PM