Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Robert Niklasson 5 posts 75 karma points
    Apr 16, 2024 @ 09:30
    Robert Niklasson
    0

    Custom properties on media items missing in Content Delivery API response

    Hi! I'm setting up a brand new Umbraco 13 API with the Content Delivery API enabled. My issue is that images that are selected with the media picker on a document type only returns the default properties of that image . Any additional properties (Alt Text e.g.) I add to the Image media type are ignored.

    If I retrieve the image through the Media Delivery API then I do indeed get the custom properties, but I'd rather avoid doing extra calls to the API since I already have all the info except for a single property in the response from the CDA.

    Am I just fetching the data incorrectly? I've tried using the expand parameter but that didn't work. Or do I indeed have to make extra calls to the api to get the missing data?

    Umbraco version: 13.1.0

    Content Delivery API:

    {
      "focalPoint": null,
      "crops": [],
      "id": "182d28bd-1d00-44f9-84d4-b5ee73d8afb1",
      "name": "Istockphoto 636475496 612X612",
      "mediaType": "Image",
      "url": "/media/xmuc0gaa/istockphoto-636475496-612x612.jpg",
      "extension": "jpg",
      "width": 612,
      "height": 408,
      "bytes": 41030,
      "properties": {}
    }
    

    Media Delivery API:

    {
      "path": "/istockphoto 636475496 612x612/",
      "createDate": "2024-02-13T15:58:19.8894778",
      "updateDate": "2024-04-16T10:22:15.5563337",
      "id": "182d28bd-1d00-44f9-84d4-b5ee73d8afb1",
      "name": "Istockphoto 636475496 612X612",
      "mediaType": "Image",
      "url": "/media/xmuc0gaa/istockphoto-636475496-612x612.jpg",
      "extension": "jpg",
      "width": 612,
      "height": 408,
      "bytes": 41030,
      "properties": {
        "altText": "Adorable puppy being an extraordinarily good boy"
      },
      "focalPoint": null,
      "crops": []
    }
    
  • Studio Bravo 2 posts 72 karma points
    Apr 26, 2024 @ 00:46
    Studio Bravo
    0

    In our non-headless solutions we could access alt text via @image.UmbracoAlt, which would come through in the SSR request.

    For our headless solutions which leverage the Content Delivery API, we run into that same problem and alt text can't seem to be retrieved for an image in the same request as the content data. The properties key is just left blank.

    enter image description here

    It would be great if the alt text could be returned in the same call, but beyond making additional Media Delivery API requests, we aren't sure how.

  • Mateusz Kotwica 31 posts 131 karma points
    Nov 29, 2024 @ 13:31
    Mateusz Kotwica
    0

    Hey Robert,

    have you found a solution to your problem? I face exactly the same issue.

  • Robert Niklasson 5 posts 75 karma points
    28 days ago
    Robert Niklasson
    0

    Hey Mateusz, I'm afraid I haven't found a solution to this yet. Hoping this feature will eventually get added to the Delivery API.

  • Studio Bravo 2 posts 72 karma points
    28 days ago
    Studio Bravo
    0

    We also face the same problem and would like to avoid making a call to the Media API just to get ALT Text.

  • Mateusz Kotwica 31 posts 131 karma points
    27 days ago
    Mateusz Kotwica
    0

    Well... I managed to do overcome this. I created my custom implementation of IApiMediaBuilder and IWebhookOutputExpansionStrategy and replaced the original services with them.

    Not really elegant but efficent :)

  • nehakakar 20 posts 90 karma points
    6 days ago
    nehakakar
    0

    I also faced this issue with the Content Delivery API not returning custom properties like Alt Text. It would be great if Umbraco could include these properties in the same call to avoid extra API requests. Hoping for a future update to address this

Please Sign in or register to post replies

Write your reply to:

Draft