AEM 6.5 Graphql persistent query use with Java Apollo client | Community
Skip to main content
Level 3
January 4, 2023

AEM 6.5 Graphql persistent query use with Java Apollo client

  • January 4, 2023
  • 2 replies
  • 1542 views

Hi,

 

We are trying to consume the persistent query created in AEM inside the Java backend code using the Apollo Graphql client. The persistent query is working fine directly in the browser as well as Java backend codebase is fetching the result for a normal graphql query with the Post request but somehow throwing an error for the persistent query with the Get request. Wondering if anyone consumed persistent queries with the help of the Apollo Graphql client and provide some sample code?

 

Thanks.

Mukesh 

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

2 replies

Manu_Mathew_
Community Advisor
Community Advisor
January 5, 2023

@mukeshaem Could you please also specify what is the error that you are getting?

MukeshAEMAuthor
Level 3
January 5, 2023

@manu_mathew_ , Apollo client supports automatic persisted queries. AEM has queries already persisted with a given name and does not accept the query passed on by the client which has the list of variables and a hash for the query. Once this is persisted on the server end, further calls from the client would only include the variables and the hash. Wondering if AEM supports such a feature for persistence where it accepts the queries from the client and stores the hash? 

krati_garg
Adobe Employee
Adobe Employee
January 6, 2023

@mukeshaem Do you have any query parameters being passed to the Persistent Query?

If yes, can you post the snippet with GET request?

MukeshAEMAuthor
Level 3
January 10, 2023

Hi @krati_garg , Yes, we need to pass a few parameters. It seems the Apollo client doesn't provide the option to perform Get request to a persistent query. We were able to consume it using a regular Rest call. Ask is if someone has used the Apollo client to call persistent queries and provide some code snippets.

krati_garg
Adobe Employee
Adobe Employee
January 10, 2023

@mukeshaem Can you try the query with ; instead of ? for query parameters