Expand my Community achievements bar.

How to use AEM graphql without persisted queries

Avatar

Level 2

 

AEM persisted GraphQl querry is working as expected

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

 

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{expec...

and also how to pass query parameters in this case.

 

Is this the right approach to make a custom querry ?

 

Please advice . Thank you 

 

Topics

Topics help categorize Community content and increase your ability to discover relevant content.

1 Reply

Avatar

Level 5

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...

 

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

 

 

Hope this helps !

 

Thanks