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 ?
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.
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.
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.
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.
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
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 ?
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.
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.
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.
is working on a reply...