How to get the cover picture URL?

Users can choose a cover/title image for blog posts. Either by selecting an Unsplash image or by uploading a custom image. I want to display these images in a macro.

When searching for blog posts by using requestConfluence("/wiki/rest/api/content/search?cql=..."), I can expand to get information about the cover image.

If it is an Unsplash image, contains the image URL – great. But if it is an uploaded image, the id field only contains a UUID, and I don’t know how to build the image URL from that.

Can anyone help?

You’ll need to fetch the image from the Atlassian media service using the uuid. You can use either MediaImage or MediaCard to display the media image.

1 Like

Hi @LuluWang, thanks for your reply.
I can’t reach your links, but found MediaImage.

For a MediaImage, I need a MediaClient, and to create that, I need an authProvider (and maybe an initialAuth). How do I get that provider? Could you show working example code?

Hi @LuluWang, did you see my reply?
It would be really useful to be able to use the blog post cover picture in our app.