I know that we can use POST method to make normal GQL query and perform GQL Ops but I wanted to know how can we achieve the same for persisted query, when I make a POST call with variables, I get an error:
When I copy URL which takes variables AEM gives URL which looks like this:
https://<DOMAIN>/graphql/execute.json/GetArticlesByID;filterExpressions=
and here's how my variable looks like:
{
"filterExpressions": {"_logOp":"OR","_expressions":[{"value":"422322","_operator":"EQUALS"},{"value":"422321","_operator":"EQUALS"}]}
}
when I pass it directly in filterExpressions, it gives me error saying:
Solved! Go to Solution.
Views
Replies
Total Likes
I needed to encode my parameters using URIEncode after which it worked fine.
You can pass the parameters like this
Query variables can be used with Persisted Queries. The query variables are appended to the request prefixed with a semicolon (;
) using the variable name and value. Multiple variables are separated by semicolons.
The pattern looks like the following:
<AEM_HOST>/graphql/execute.json/<PERSISTENT_QUERY_PATH>;variable1=value1;variable2=value2
Check the example given here
I needed to encode my parameters using URIEncode after which it worked fine.
Could you please provide the complete url (non-encoded and encoded)? Even after encoding, I still get the error.
Hey @spidey1405 @rakesh_h
I'm having exactly the same issue, would be great if you can share more details if you resolved it.
Thanks
Views
Replies
Total Likes
For me it works when I changed the url to
Views
Likes
Replies