I want to consumer graphQl API. I know we need to use http requester to call graphQl. I need some info on forming mutation request using dwl. I was trying to hit this service https://www.predic8.de/fruit-shop-graphql using below
%dw2.0
outputapplication/json
---
{
"query": "mutation(\$input:addCategoryInput!) { addCategory(input:\$input) { name products { name}} }",
"variables": {
"input": {
"id": 6,
"name": "Green Fruits",
"products": 8
}
}
}
its throwing bad request But when using below
%dw 2.0
output application/json
---
{
"query": "mutation { addCategory(id: 6, name: \"Green Fruits\", products: 8) { name products { name } }}"
}
its working. I want to use above format. Are both not valid requests. Please share me your knowledge or guide me to right blog to refer.