AEM 6.5 Graphql Query for UUID | Community
Skip to main content
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

narendragandhi
Community Advisor
Community Advisor
April 3, 2024

Hi @mukesh_kumar_co 

 

Have you tried using path as an unique identifier. You can refer the documentation for further details and an example query for the same - https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/headless/graphql-api/content-fragments

 

Hope this helps!

 

Thanks

Narendra

Mukesh_Kumar_Co
Level 3
April 4, 2024

_path returns a relative path which change after author move the content to another folder. I'm looking for some ID which should be unique and not change for a content.

Raja_Reddy
Community Advisor
Community Advisor
April 8, 2024

Hi @mukesh_kumar_co 

In AEM, Content Fragments have a unique identifier called `cq:contentFragment`, which can be used to fetch the content fragment's content. This identifier remains constant even if the content fragment is moved to another folder.

To fetch the content of a specific Content Fragment using its unique identifier, you can use the `cq:contentFragment` property in your GraphQL query. 

{ contentFragmentByPath(path: "/content/dam/my-site/my-fragment") { cq:contentFragment { elements { title description // other fields } } } }



In the above example, `cq:contentFragment` is used to fetch the content of the Content Fragment located at `/content/dam/my-site/my-fragment`. You can replace this path with the actual path of your Content Fragment.

Mukesh_Kumar_Co
Level 3
April 8, 2024

@raja_reddy I tried to execute the above query in my AEM instance but it shows the error attached in the screenshot. Wondering if I'm missing something.
I wanted to query all the content fragments available at a path along with a unique ID. Can you share the query please?

 

EstebanBustamante
Community Advisor and Adobe Champion
Community Advisor and Adobe Champion
April 9, 2024

@mukesh_kumar_co Did you find the suggestions from users helpful? Please let us know if more information is required. Otherwise, please mark the answer as correct for posterity. If you have found out solution yourself, please share it with the community

Esteban Bustamante
Mukesh_Kumar_Co
Level 3
April 9, 2024

It seems interesting but somehow I was unable to use the suggested solution in my instance. I have responded with follow-up question.