Expand my Community achievements bar.

Enhance your AEM Assets & Boost Your Development: [AEM Gems | June 19, 2024] Improving the Developer Experience with New APIs and Events
SOLVED

Enable DynamicMedia for assets served by GraphQL query

Avatar

Level 4

I'm using GraphQL to retrieve DAM content from AEM and I get the _publishUrl as 

 

 

 

https://publish-p******.adobeaemcloud.com/content/dam/my-project/folder1/subfolder1/imageName.jpg

 

 

 

I don't want to expose the publish url of my AEM instance. Instead, I have Dynamic Media enabled and I want the url to come from there like :

 

 

https://dev.domain.com/adobe/dynamic/....
https://qa.domain.com/adobe/dynamic/....

 

 

 

for Dev, QA and other environments. Is there a way to achieve this?

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

According to the documentation you should use the "_dynamicUrl" field on the ImageRef, this is supposed to work only in AEMaaCS

 

Please let me know if that works

 

See more here:

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/web-opti...

 



Esteban Bustamante

View solution in original post

8 Replies

Avatar

Community Advisor

@rakesh_h2 Thats a good RFE(Request For Enhancement). But in the meantime if you want to get the URLs by code you can build the DM URL for an image/video using "Scene7Service"

 

https://developer.adobe.com/experience-manager/reference-materials/6-4/javadoc/com/day/cq/dam/scene7...

 

 

Avatar

Community Advisor

@rakesh_h2 below is the sample code of getting the image/video urls using Scene7Service from WCMUsePojo class.

 

public void setS7DynamicMediaModel() {
		Scene7Service scene7Service = getSlingScriptHelper().getService(Scene7Service.class);

		String productionImageServerUrl = StringUtils.stripToEmpty(scene7Service.getPublishServerUrl(this.getResource(), this.getResourceResolver()));
		String imageServerUrl = scene7Service.getPreviewServerUrl(this.getResource(), this.getResourceResolver());
		String previewVideoProxyUrl = scene7Service.getPreviewVideoServerUrl(this.getResource(), this.getResourceResolver());
		String productionVideoServerUrl = scene7Service.getPublishVideoServerUrl(this.getResource(), this.getResourceResolver());

        

	}

 

Avatar

Correct answer by
Community Advisor

According to the documentation you should use the "_dynamicUrl" field on the ImageRef, this is supposed to work only in AEMaaCS

 

Please let me know if that works

 

See more here:

https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/headless/graphql-ap...

https://experienceleague.adobe.com/docs/experience-manager-core-components/using/developing/web-opti...

 



Esteban Bustamante

Avatar

Level 4

@EstebanBustamante How do I get _dynamicUrl for audio, video files? I'm not getting that in the Query editor.

rakesh_h2_0-1689002517760.png

 

Avatar

Community Advisor

I think for now you cannot use dynamic media for videos via GraphQL although i could be wrong.



Esteban Bustamante