Copied to clipboard

Flag this post as spam?

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


  • mrclan 8 posts 79 karma points
    May 09, 2017 @ 05:01
    mrclan
    0

    How to get images in a document type using Umbraco REST API ?

    After exposing the CMS content using the REST API nuget package, the backend data is readily available but the image data is not.

    I've a DocumentType, say Person for eg., with name, age and displayPicture. When querying the api endpoint for that particular node, the textual data is returned fine. But for the displayPicture, an URI starting with umb:\\ and a guid is returned.

    So, my question is, how do we resolve this uri to retrieve the actual image ?

    Thanks.

  • David Peck 687 posts 1863 karma points c-trib
    May 09, 2017 @ 07:59
    David Peck
    0

    I'm guessing you're using 7.6. The Guids are new. You should just be able to hit the API again using 'Get Media' method and supplying the GUID (or perhaps umb://GUID) as an argument.

    David

  • mrclan 8 posts 79 karma points
    May 09, 2017 @ 11:24
    mrclan
    0

    Thanks for the reply David. Yes, I'm using the latest version of Umbraco, which happens to be 7.6.

    Is, GetMedia a new api endpoint ? If yes, what is the full url ?

    I'm a little confused. Can you please point to any documentation or relevant example ?

  • David Peck 687 posts 1863 karma points c-trib
    May 09, 2017 @ 12:24
    David Peck
    0

    Not sure TBH. I don't have it to hand. If it's not obvious then there must be a GetContent or GetContentById or something like that that should work.

  • mrclan 8 posts 79 karma points
    May 09, 2017 @ 15:36
    mrclan
    0

    Thanks again David, but I don't think there is any thing like that exposed as a REST ENDPOINT. Also, I'm unable to understand the rationale behind this umb:// , way of returning back images.

  • David Peck 687 posts 1863 karma points c-trib
    May 09, 2017 @ 19:14
    David Peck
    0

    umb://* is the new format for IDs. See: https://our.umbraco.org/forum/extending-umbraco-and-using-the-api/85119-using-the-new-umbdocumentguid

    An image is a piece of content, just like a page. Where one piece of content references another (like your page referencing an image) it doesn't send both down, it just passed down the ID. If you want the image you'll need to make another API call.

Please Sign in or register to post replies

Write your reply to:

Draft