CF Graphql issues | Community
Skip to main content
Level 2
July 19, 2023
Solved

CF Graphql issues

  • July 19, 2023
  • 1 reply
  • 762 views

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!

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by EstebanBustamante

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/ContentFragment.html

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-can-we-create-content-fragment-via-code/m-p/425601 

1 reply

EstebanBustamante
Community Advisor and Adobe Champion
EstebanBustamanteCommunity Advisor and Adobe ChampionAccepted solution
Community Advisor and Adobe Champion
July 20, 2023

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/ContentFragment.html

https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/how-can-we-create-content-fragment-via-code/m-p/425601 

Esteban Bustamante