Custom action fails for unexpected reason


Note: This article applies to the web services data actions integration.

When you test a custom action in PureCloud for your web services data actions integration, the action fails for unexpected reasons in PureCloud but works in REST API clients like Postman.

By default, PureCloud encodes the data in requests and responses for actions as Transfer-Encoding: chunked. Web services that do not support Transfer-Encoding: chunked return incorrect errors, such as “Invalid JSON” even when the body is valid JSON.

For web services that do not support Transfer-Encoding: chunked, add Transfer-Encoding: buffered to the JSON for requests in PureCloud. If you set Transfer-Encoding to buffered, then PureCloud includes a Content-Length header behind the scenes and sends all the data in a single request or response. 

{
  "requestUrlTemplate": "https://www.example.com/health/check/services/${input.service}",
  "requestType": "GET",
  "headers": {
    "Transfer-Encoding": "buffered"
  },
  "requestTemplate": "${input.rawRequest}"
}

For more information, see Test data actions and Add configuration to custom actions.

For more information about the integration, see About the web services data actions integration.