Expand my Community achievements bar.

Learn about Edge Delivery Services in upcoming GEM session
SOLVED

CF Graphql issues

Avatar

Level 2

Hi Team,

Could anyone help me to provide AEM Graphql backend APIs. I'm facing many issues while using the below. And may I know any other graphql APIs to fetch the endpoint data through backend code? Kindly help

 

import graphql.GraphQL;
import graphql.schema.GraphQLSchema;

 

Thank you!

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

I don't know what you are trying to achieve, but I think you should explore the below alternatives instead of using a GraphQL API:

- GraphQL exposes data as REST API, so technically you could use any REST java framework such as Httpclient, HttpUrlConnection, etc. to call the GraphQL endpoint.

- The GraphQL exposes the data from Content Fragments models (CFM), this same data is accessible if you are working on the AEM backend, you can also consider accessing directly the CFM by their own API instead of adding an extra call to the REST GraphQL API, you could use something like this: https://aemsimplifiedbynikhil.wordpress.com/2020/10/11/content-fragment-as-java-apis/ OR this https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/ 

 

References:

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

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-can-we-create-content-... 



Esteban Bustamante

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

I don't know what you are trying to achieve, but I think you should explore the below alternatives instead of using a GraphQL API:

- GraphQL exposes data as REST API, so technically you could use any REST java framework such as Httpclient, HttpUrlConnection, etc. to call the GraphQL endpoint.

- The GraphQL exposes the data from Content Fragments models (CFM), this same data is accessible if you are working on the AEM backend, you can also consider accessing directly the CFM by their own API instead of adding an extra call to the REST GraphQL API, you could use something like this: https://aemsimplifiedbynikhil.wordpress.com/2020/10/11/content-fragment-as-java-apis/ OR this https://aemdeveloper.wordpress.com/2017/08/22/create-access-the-content-fragment-programmatically/ 

 

References:

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

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-can-we-create-content-... 



Esteban Bustamante