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 1 post 71 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": []
    }
    
  • Pat Mancini 1 post 71 karma points
    Apr 26, 2024 @ 00:46
    Pat Mancini
    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.

Please Sign in or register to post replies

Write your reply to:

Draft