GraphQL in AEM

Kinjal P Darji
2 min readMay 4, 2022

GraphQL is a query language for APIs. It is popular for headless usecases. Client applications like mobile, devices can make a query using GraphQL and get the data they want in mostly JSON format.

Using GraphQL the client application can request for the exact data they want. It can fetch multiple resources in the single request. It can consolidate the queries, which minimizes the http requests to the server. It is strongly typed and ensures the data is as per the data model.

Mostly in AEM, GraphQL is implemented to be used with content fragments. Content fragments have content fragment models. Once a content fragment model is defined, multiple content fragments can be created using the same model. These content fragments are exposed using GraphQL APIs. Content fragments can have reference to other content fragments or contents like images. GraphQL can make a query for content fragment or any property of reference in the content fragment.

In order to work with GraphQL in AEM, it is required that AEM SDK is installed first. Download AEM SDK from Adobe’s software distribution site.

GraphQL can be downloaded and installed on AEM from Adobe’s software distribution site. It can be accessed in local environment using http://localhost:4502/content/graphiql.html

Following the sample view of the GraphQL tool in AEM.

--

--

Kinjal P Darji

Hi, I am an AEM architect and a certified AWS Developer — Associate.