SNIPPET GetRESTProxy 502 Bad Gateway on internal API with JSON body

Running into a wall with a action in CXone . I’m trying to call an internal service to validate a loyalty tier before routing the call. The endpoint works fine in Postman, but the script fails consistently.

Here is the relevant part of the script:

// Setup the REST Proxy
ASSIGN rest = GetRESTProxy("internal-loyalty-service");
ASSIGN req = rest.NewRequest();
req.Method = "POST";
req.Path = "/v1/tier/validate";
req.SetHeader("Content-Type", "application/json");

// Build the payload from variables
ASSIGN body = "{}";
body["phone"] = Call.CallerID;
body["account"] = Call.AccountID;

req.SetBody(body);

// Execute
ASSIGN response = rest.Execute(req);

The response.StatusCode is coming back as 502. The response.Body is empty.

I’ve checked the CXone logs. The outbound IP is whitelisted on our side. The internal service logs show no incoming request from Genesys at all during the failure. This suggests the request isn’t making it to our server, or it’s being dropped by the CXone proxy layer before it leaves the network.

Things I’ve tried:

  • Changed the method to GET and passed params in the query string. That worked. So the proxy connection itself is fine.
  • Checked the body variable in debug mode. It looks like valid JSON: {"phone":"15550100","account":"ACC123"}.
  • Verified the integration config in the Admin portal. The URL is correct. No auth headers required for this test endpoint.

Is there a character limit on the body size for GetRESTProxy? Or does the engine choke on certain JSON structures? The payload is tiny.

Also noticed that if I add a custom header like X-Trace-ID, the 502 happens even with a GET request. Removed that header and POST works again? No wait, it still fails with POST. Only GET works.

Anyone seen this before? Feels like a bug in the runtime engine handling POST bodies in actions.