Hi @amitvishwakarma
Thanks connection issue is resolved in postman it is showing response.
Really appreciate for this help.
one more issue i have - after passing the above query the response,it should not return all the fields in response as in payload query, we passed only id fields but i am getting all fields data in response. I am using persistent query with endpoint format - aemcloud.com/graphql/execute.json/
any thing needs to be changed so that response can come based on query payload passed in request?
Hi @aem_leadi6 ,
You're using Persistent Queries (via /graphql/execute.json/...), which are precompiled on AEM, and do not consider the request payload’s query.
Instead, AEM only executes the query as stored in the persisted query file. So even if you pass a different query in the POST body, it won’t be used.
To make the response match your dynamic query payload, you must use the standard GraphQL endpoint, not the persistent one.
Option 1: Use Standard GraphQL Endpoint (Supports Custom Queries)
Use:
https://<your-domain>.aemcloud.com/graphql/<endpoint-name>
With POST body:
{
"query": "query { test41List { items { id } } }",
"variables": {}
}
This way, only id field will be returned — exactly what you define in the query.
Option 2: Persistent Queries Don’t Support Custom Fields
If you're using:
https://<your-domain>.aemcloud.com/graphql/execute.json/<query-name>
Then AEM ignores any payload it runs only the query as defined and saved in /conf/.../graphql/queries/<query-name>.gql.
To limit fields there, you need to edit that .gql file and save only the fields you want, like:
query {
test41List {
items {
id
}
}
}
Then re-deploy or sync this to your AEM environment.
Regards,
Amit