Anton_Vroon | 2024-07-10 00:46:08 UTC | #1
I have a data action with the below request, which is a graphql query. This works perfectly fine in Postman. Other requests without the inline fragmentation (the ... bit) work just fine as well.
payload:
#set ($d = $esc.dollar )
{
"variables": {
"accessNumber": ${input.accessNumber}
},
"query": "query Query($(d)accessNumber: Int!) { party(accessNumber: $(d)accessNumber) { ... on Person { firstName } }}"
}
Response template:
The error response I get is not helpful.
[details="Response"]
{
"message": "The request could not be understood by the server due to malformed syntax.",
"code": "bad.request",
"status": 400,
"messageParams": {},
"contextId": "6b3a1aef-cdd8-480a-a516-65589e7b1b03",
"details": [
{
"errorCode": "ACTION.REMOTE_ENDPOINT"
}
],
"errors": [
{
"message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {\"errors\":[{\"message\":\"parsing error: syntax error: expected a Name\",\"locations\":[{\"line\":1,\"column\":14}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a Name\",\"locations\":[{\"line\":1,\"column\":14}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected R_PAREN, got (\",\"locations\":[{\"line\":1,\"column\":14}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a Selection Set\",\"locations\":[{\"line\":1,\"column\":14}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected definition\",\"locations\":[{\"line\":1,\"column\":15}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":16}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected definition\",\"locations\":[{\"line\":1,\"column\":17}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":29}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected definition\",\"locations\":[{\"line\":1,\"column\":31}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":34}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":35}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a Name\",\"locations\":[{\"line\":1,\"column\":60}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected R_PAREN, got (\",\"locations\":[{\"line\":1,\"column\":60}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected R_CURLY, got (\",\"locations\":[{\"line\":1,\"column\":60}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":60}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected definition\",\"locations\":[{\"line\":1,\"column\":61}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":62}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected definition\",\"locations\":[{\"line\":1,\"column\":63}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":75}],\"extensions\":{\"code\":\"PARSING_ERROR\"}},{\"message\":\"parsing error: syntax error: expected a StringValue, Name or OperationDefinition\",\"locations\":[{\"line\":1,\"column\":108}],\"extensions\":{\"code\":\"PARSING_ERROR\"}}]} [6b3a1aef-cdd8-480a-a516-65589e7b1b03]",
"code": "BAD_REQUEST",
"status": 400,
"messageParams": {},
"details": [],
"errors": []
}
]
}
[/details]
So just looking at how to escape the eclipisis (...) in the string to work as intended.
Anton_Vroon | 2024-07-10 01:28:41 UTC | #2
Anton_Vroon, post:1, topic:27169
"query": "query Query($(d)accessNumber: Int!) { party(accessNumber: $(d)accessNumber) { ... on Person { firstName } }}"
Think there was just some white spaces where there shouldn't have been. this works "query": "query Party(${d}accessNumber: Int!) {party(accessNumber: ${d}accessNumber) { ... on Person{displayName gender}}}"
Anton_Vroon | 2024-07-10 01:41:21 UTC | #3
d{} not d()
sigh there goes way to much time figuring that out
system | 2024-08-10 01:42:14 UTC | #4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 27169