Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

AEM 6.5 Graphql persistent query use with Java Apollo client

Avatar

Level 3

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 

5 Replies

Avatar

Level 3

@ManuMathew1994 , 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? 

Avatar

Employee

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

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

Avatar

Level 3

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.