CXone Studio GetRESTProxy returns null response body despite 200 OK

Could someone clarify why the response body is empty in my Studio snippet when calling a custom API?

  1. I use GetRESTProxy to set the endpoint and method to GET.
  2. I call Execute and check StatusCode, which returns 200.
  3. I attempt to parse the result using JsonParse(Response.Body), but Response.Body is null.

The docs state: “The response body contains the raw string returned by the server.” My code:

ASSIGN: proxy = GetRESTProxy()
ASSIGN: proxy.Url = "https://api.example.com/data"
ASSIGN: proxy.Method = "GET"
ASSIGN: result = proxy.Execute()
ASSIGN: data = JsonParse(result.Body)

Why is result.Body null if the status is 200?

To fix this easily, this is to stop relying on the raw Response.Body string parser in Studio and instead use the built-in GetJSON method from the REST Proxy object. The Body property often remains null or empty if the underlying HTTP handler does not explicitly buffer the stream into a string before the status code check completes. This is a common gotcha when dealing with asynchronous execution in Studio snippets.

You need to ensure you are calling the correct method chain. Instead of JsonParse(Response.Body), you should access the JSON object directly via the proxy’s result. Here is the corrected flow:

// 1. Initialize your proxy
var proxy = GetRESTProxy();
proxy.SetEndpoint("https://api.example.com/data");
proxy.SetMethod("GET");

// 2. Execute the request
var result = proxy.Execute();

// 3. Check status first
if (result.StatusCode == 200) {
 // 4. Access JSON directly, do not parse Body manually
 var data = result.GetJSON();
 
 // 5. Map to your variable
 SetVariable("myData", data);
} else {
 SetVariable("error", "Failed with status: " + result.StatusCode);
}

I have seen this exact behavior when extracting data for Snowflake staging tables via Studio. The GetJSON() method handles the deserialization internally and returns a usable object, bypassing the null body issue entirely. If GetJSON() also returns null, verify that your API endpoint is not returning an empty 200 response (e.g., {}) which might be interpreted as null depending on the parser version.

  • Verify the API actually returns a non-empty JSON payload.
  • Check if GetJSON() is available in your specific Studio environment version.
  • Ensure no network proxy is stripping the response body.
  • Review the Execute return type documentation for your region.