I'm trying to create a DataAction to create a callback. I followed a Request Template I saw on this forum, and modified it to handle an agent owned callback.
When I do a test, I have all of the input parameters filled, but I get back an error:
"REST call for action execute failed. Message: Request to backend service failed. Response from web service: {"message":"callbackNumbers is required","code":"callback.error.missing.callback.numbers"
But I am sending the callback number.
Since I can't see what is the actual JSON request being sent to the API, is there a way for me to troubleshoot this?
Does anyone see anything blatantly incorrect?
EDIT: I noticed the escape characters are removed when I post. But know that the escape characters are before every double-quote within the requestTemplate value.
I'm still getting the same error. I put the quotes around $(input.score} however, I omitted them originally because it is an integer value, not a string.
I added the curly bracket within the scoredAgents array (good catch). But the error persists...
Have you copied the complete JSON within the Request Body Template? This is only done if you change the Action Configuration from Simple to JSON (which is at the top under Configuration tab).
Anyways, under configuration tab, check to confirm your configuration looks like
and copy the following inside Request Body Template. make sure score is configured as Integer under Input Contracts (yes in that case don't need quotes)
I got it to work, but I'm not exactly sure why it works now.
Steps:
Rebuild the Data Action (still failed with same error)
Take the API Explorer JSON request which works and put that into the Request Template, escaping the double-quotes, and all values are hardcoded. It worked.
Gradually replaced hard-coded values, one at a time, with ${input.xxxxx}, and each time it continued to work
I decided to leave the routing flag and score hardcoded because for the purpose of this Data Action, it will always be those values.
EDIT: I also just now noticed in my reply above, when I showed the JSON of the request template, "requestTemplate" was included in the string value of the requestTemplate. I'm not sure how that got there when the "Simple" version did not show that. So that is likely the cause of the problem since the JSON is in a different structure and it couldn't find the callbackNumbers node.