GraphQL queries call using Sling servlet and models | Community
Skip to main content
Prince_Shivhare
Community Advisor
Community Advisor
February 20, 2021
Solved

GraphQL queries call using Sling servlet and models

  • February 20, 2021
  • 2 replies
  • 4001 views

Hi Team,

 

I want to send the GraphQL queries to Magento and then Magento sends back a response.

 

can anyone help me how I can achieve this by using sling servlet and models.

 

I investigated about it but haven't found anything in google.

 

Thanks,

Prince

 

@mhaack @daniel_gordon 

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 raj_mandalapu

@prince_shivhare the POC which I did an year back should help you ,check below article.

http://www.coderss.in/read-magento-product-data-via-graphql-in-aem/

 

2 replies

raj_mandalapu
raj_mandalapuAccepted solution
February 21, 2021

@prince_shivhare the POC which I did an year back should help you ,check below article.

http://www.coderss.in/read-magento-product-data-via-graphql-in-aem/

 

raj_mandalapu
February 22, 2021

Hi Prince, the CIF helps use to make the development faster and it is an accelerator for your CIF project, when it comes to hitting graphql then you need to make a http request by passing inputs as json format. check below links https://amasty.com/blog/magento-2-api-updates-graphql/

https://devdocs.magento.com/guides/v2.4/graphql/

 

mhaack
Adobe Employee
Adobe Employee
February 22, 2021

Hi @prince_shivhare  this is easy to solve 🙂

 

The entire CIF Core Components project is your example. It provides the graphql client (which is independent form the backend) which accepts any GraphQL query. For Magento we provide addition helpers and a full step of data model classes representing the Magento Schema. This allows you to work with Java objects instead with GraphQL query strings. For example the product teaser component https://github.com/adobe/aem-core-cif-components/blob/master/bundles/core/src/main/java/com/adobe/cq/commerce/core/components/internal/models/v1/productteaser/ProductRetriever.java 

 

My colleague Mark and me did a tech talk during last adapt.to conf and CIF GraphQL usage and customization: https://adapt.to/2020/en/schedule/graphql-services-in-the-aem-world.html

 

Markus

kautuk_sahni
Community Manager
Community Manager
February 23, 2021
Good to see you back, Markus in the AEM community. And Thank you for posting an answer here.
Kautuk Sahni