Hello everyone !
I'm facing a problem with AEM persistent queries and the variables used in those. The problem is that i use a variable in a filter that look like this :
filter: {
brand: {
_logOp: OR,
_expressions: $brands
}
}
The variables brands is declared as "[StringFilterExpression]!".
So now if a want to use my persistent query, i use Postman and i do a POST request on :
publish-[...].adobeaemcloud.com/graphql/execute.json/id/getByBrands
and i send this in the body (in application/json) :
{
"variables": {
"brands": [{"value": "mybrand"}]
}
}
But I get this response from AEM :
"message": "Variable 'brands' has an invalid value: Variable 'brands' has coerced Null value for NonNull type '[StringFilterExpression]!'"
I already tried with other variables types, like a variable for the limit property, where i set a variable $limit as "Int" and when i send (for example) :
{
"variables": {
"limit": 1
}
}
There is no problem and the variable is understood.
And if i do a GET request using :
publish-[...].adobeaemcloud.com/graphql/execute.json/id/getByBrands;brands=[%7B"value":%20"test"%7D]
I get this error :
"message": "Variable 'brands' has an invalid value: Expected type 'Map' but was 'String'. Variables for input objects must be an instance of type 'Map'."
And same here with a variable $limit as "Int" i have no problems.
I don't understand why ? Also when i'm using the GraphiQL Explorer in the AEM Backoffice i have no problem, i can pass my variable brands without error like that :
Does anyone have a solution to this problem and could share it with me?
Thank you!