sureshu | 2022-11-14 18:03:48 UTC | #1
Dear Team, We are preparing data action to get data. Upstream system provided GraphQL Postman request. It works fine with Postman. But we need help with Genesys Cloud Data Action.
Could you please help how to setup this up in the Request Body Template ?
{ "requestUrlTemplate": "https://XXXXXXXX/graphql", "requestType": "POST", "headers": { "Authorization": "${authResponse.tokenType}${authResponse.accessToken}", "jnj-correlation-id": "XXXX" }, "requestTemplate": "#set ( $d = $esc.dollar )\n{\"query\": \"hcps(${d}FindHCP: FindHCP!) {hcps(find: ${d}FindHCP){territories {name}}}\",\"variables\": {\"FindHCP\": {\"phone\": \"${input.phone}\"}}}" }
Error: "message": "REST call for action execute failed. Message: Request to backend service failed. Response from web service: {\n \"errors\" : [ {\n \"message\" : \"Unable to parse GraphQL query.\",\n \"errorType\" : \"MalformedHttpRequestException\"\n } ]\n} [XXXXXX]",
Greg_Cunningham | 2022-11-14 18:51:27 UTC | #2
I ran the requestTemplate through an echo endpoint to see what it returns. The following is what was sent by the template:
{ "query": "hcps($FindHCP: FindHCP!) {hcps(find: $FindHCP){territories {name}}}", "variables": { "FindHCP": { "phone": "phone-tn" } } }
Is this what works in Postman?
sureshu | 2022-11-14 19:01:36 UTC | #3
Greg_Cunningham, post:2, topic:17206
at works in Postman?
Hi George, Thanks for Checking on this. This is What Works in POSTMAN:
GraphQL Query: query hcps($FindHCP: FindHCP!){ hcps(find: $FindHCP){ territories{ name } } }
GraphQL Variable: { "FindHCP" :{"phone":"00123456789"}}
sureshu | 2022-11-15 16:10:20 UTC | #4
Hi George,
Thanks for your support. I am able to fix it. Here is the fixed version might be helpful to someone else.
set ( $d = $esc.dollar )
{ "query": "query hcps(${d}FindHCP: FindHCP!){hcps(find: ${d}FindHCP){territories{name}}}", "variables": { "FindHCP": { "phone": "${input.phone}" } } }
system | 2022-12-15 19:37:13 UTC | #5
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: 17206