Stuck on parsing a REST response in a CXone Studio SNIPPET action. I’ve got a simple flow where I need to fetch a JSON blob from an external service (internal microservice, no auth headers needed for now) and then assign a specific field to a contact attribute.
The call seems to work, at least the status code comes back as 200. But when I try to access the response body, it’s completely empty. No error, no data.
Here’s the snippet code:
ASSIGN [REST_PROXY] = GETRESTProxy("https://internal-api.example.com/v1/data/12345")
ASSIGN [REST_RESPONSE] = REST_PROXY.Execute("GET")
IF [REST_RESPONSE.Status] == 200
ASSIGN [Contact.custom.payload] = REST_RESPONSE.Body
ELSE
ASSIGN [Contact.custom.error] = REST_RESPONSE.Status
END_IF
I added a debug log right after the Execute call. The output for [REST_RESPONSE] looks like this:
{
"Status": 200,
"Headers": {
"Content-Type": "application/json"
},
"Body": ""
}
The Body field is just an empty string. I checked the external service logs, and it’s definitely returning a JSON object like {"id": 12345, "status": "active"}. I’ve tried changing the verb to POST with a dummy payload, same result. Body is empty.
I know the endpoint is reachable because I can hit it from Postman and get the data. Is there a timeout happening in the snippet context? Or do I need to explicitly set a header in the GETRESTProxy config to handle JSON? The docs for GETRESTProxy are pretty sparse on error handling for non-200 responses, but this is a 200.
Tried wrapping the body in a string conversion just in case, didn’t help. Also tried accessing REST_RESPONSE.Body.id directly, which obviously failed since the body is empty.
What am I missing here?