How to use AEM graphql without persisted queries | Adobe Higher Education
Skip to main content
Level 2
December 17, 2024
解決済み

How to use AEM graphql without persisted queries

  • December 17, 2024
  • 1 の返信
  • 706 ビュー

 

AEM persisted GraphQl querry is working as expected

https://author-zzz-zzz.adobeaemcloud.com/graphql/execute.json/folder/persisted-querry-name;path=CF_path

 

Similar to magento graphQL I want to use my custom query like below  in url insted of persisted query and hit graphQL API in AEM. Currently below query is not showing any results.

 

https://author-zzzz-zzz.adobeaemcloud.com/graphql/execute.json?query={plannedOutagesList{items{expectedStartTime}}}

and also how to pass query parameters in this case.

 

Is this the right approach to make a custom querry ?

 

Please advice . Thank you 

 

ベストアンサー PRATHYUSHA_VP

Hi ,

 

Query should be send as below example using Curl command.

Looks like you're trying to pass full query in AEM graphQL URL which is not the viable option

 

There are three ways to do this in AEM :

 

  1. GraphiQL IDE 
  2. cURL  (refer below example)
  3. Other tools (Example : Postman)

 

$ curl -X PUT \ -H 'authorization: Basic YWRtaW46YWRtaW4=' \ -H "Content-Type: application/json" \ "http://localhost:4502/graphql/persist.json/wknd/plain-article-query-parameters" \ -d \ 'query GetAsGraphqlModelTestByPath($apath: String!, $withReference: Boolean = true) { articleByPath(_path: $apath) { item { _path author main { plaintext } } } }'

 

Please refer below links : 

 

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/headless/graphql-api/persisted-queries

 

https://kiransg.com/tag/persistance/

 

 

Hope this helps !

 

Thanks

1 の返信

PRATHYUSHA_VP
Community Advisor
Community Advisor
December 17, 2024

Hi ,

 

Query should be send as below example using Curl command.

Looks like you're trying to pass full query in AEM graphQL URL which is not the viable option

 

There are three ways to do this in AEM :

 

  1. GraphiQL IDE 
  2. cURL  (refer below example)
  3. Other tools (Example : Postman)

 

$ curl -X PUT \ -H 'authorization: Basic YWRtaW46YWRtaW4=' \ -H "Content-Type: application/json" \ "http://localhost:4502/graphql/persist.json/wknd/plain-article-query-parameters" \ -d \ 'query GetAsGraphqlModelTestByPath($apath: String!, $withReference: Boolean = true) { articleByPath(_path: $apath) { item { _path author main { plaintext } } } }'

 

Please refer below links : 

 

https://experienceleague.adobe.com/en/docs/experience-manager-cloud-service/content/headless/graphql-api/persisted-queries

 

https://kiransg.com/tag/persistance/

 

 

Hope this helps !

 

Thanks