😎 Discover cool tips and tricks for customization in our next Developer Deep Dive virtual event - sign up now!

Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref and _type and I need the url, I don't want to use...

3 replies
Last updated: Dec 1, 2020
Hi, I need help with a query for getting the url of an image asset.Here is what I've been trying, but I only get the _ref and _type and I need the url, I don't want to use urlFor() function because it is not an option for what I'm trying to achieve.
Dec 1, 2020, 9:41 AM
Why is urlfor not an option?
Dec 1, 2020, 12:09 PM
I need the data on a server side with minimal external package usages, why does that matter?
Dec 1, 2020, 2:02 PM
Could you try replacing this:
images[] ->{..., resourceFileImage->{image_asset->{'asset': asset->{path,url}}}}
With something like this?

images[] ->{..., 'asset': image_asset.asset->{path,url}}
Dec 1, 2020, 3:53 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?