GetRESTProxy throwing INVALID_FUNCTION in CXone Studio

I’ve been wrestling with a Studio Snippet for the last hour and I just can’t get the syntax right. I need to hit an internal REST endpoint to validate a customer ID before routing the call to the right queue.

I’m trying to use the GetRESTProxy function, but the script keeps failing with an INVALID_FUNCTION error. I’ve double-checked the function name against the docs, and it seems correct, but maybe I’m missing a namespace or a specific parameter format?

Here’s what the snippet looks like:

ASSIGN restProxy = GetRESTProxy();
ASSIGN response = restProxy.Execute("GET", "https://api.internal/validate?id=" + GetData("CustomerId"), null, {});

The error pops up right at the ASSIGN restProxy line. I’m running this in the CXone Studio environment, and I have the necessary permissions set up in Architect. Is GetRESTProxy even the right object to call here? Or do I need to use a different method to initialize the proxy first?

I’ve tried wrapping it in a try-catch block, but that just hides the error without fixing it. Any ideas on what I’m doing wrong? I’m sure it’s something stupid like a missing semicolon or a capitalization issue, but I’ve gone over it three times.

GetRESTProxy isn’t the function you want here. That’s a legacy wrapper that got deprecated in the CXone Studio runtime years ago. It throws INVALID_FUNCTION because the engine literally doesn’t recognize it anymore. You need to switch to the newer HTTP Request actions or the HttpRequest function if you’re building a custom snippet.

If you’re just doing a simple validation, the standard HTTP Request action is cleaner. Set the Method to GET, point the URL to your internal endpoint, and add any auth headers in the Headers tab. Then map the response body to a variable.

If you really need the function call syntax for a dynamic snippet, use HttpRequest. Here’s how you’d structure that payload:

var response = HttpRequest({
 method: "GET",
 url: "https://internal-api.example.com/validate?customerId=" + input.customerId,
 headers: {
 "Authorization": "Bearer " + input.apiKey,
 "Content-Type": "application/json"
 }
});

if (response.statusCode == 200) {
 // Valid customer
 return { isValid: true };
} else {
 // Invalid or error
 return { isValid: false, error: response.body };
}

Make sure your internal endpoint allows CORS if you’re testing from a browser-based debug view, though Studio usually executes on the server side so CORS shouldn’t matter for the actual flow. The biggest gotcha with these internal calls is timeout. CXone Studio has a hard limit on how long an HTTP request can take. If your internal service is slow, you’ll get a timeout error instead of an INVALID_FUNCTION. Keep the validation lightweight. Also, check that the URL is fully qualified. Relative paths don’t work here.