INVALID_FUNCTION on GetRESTProxy in CXone Studio Snippet

Is it possible to invoke GetRESTProxy() directly within a Studio Snippet block without wrapping it in a custom script or using the Evaluate function, as I am receiving an INVALID_FUNCTION error when attempting ASSIGN proxy = GetRESTProxy("https://api.cxone.com")? The documentation implies direct availability, but the runtime parser rejects the call immediately. Thanks for the help.

You need to understand that Studio Snippets operate in a restricted execution context. They do not support direct invocation of complex API functions like GetRESTProxy() because the snippet parser expects simple variable assignments or basic string manipulations. The INVALID_FUNCTION error occurs because the runtime engine does not expose this method in that specific scope.

To resolve this, you must move the logic into a Custom Script block or use the Evaluate function if you are strictly within a flow. Here is the correct pattern using a Custom Script:

var result = GetRESTProxy("https://api.cxone.com", "GET", null, null, 10000);
SetParticipantAttribute("proxyResult", result);
  1. Create a Custom Script block in Architect.
  2. Paste the JavaScript logic above.
  3. Retrieve the result via GetParticipantAttribute in subsequent blocks.

This ensures the function executes in the proper engine context. Direct assignment in snippets will always fail for this specific function.

This looks like a context limitation issue rather than a syntax error. The suggestion above about restricted execution is correct, but you can bypass the parser limitation by using a pure Data Action call instead of trying to force the function into a snippet. Direct invocation fails because the snippet engine lacks the HTTP client context.

{
 "name": "GetExternalData",
 "type": "rest",
 "operation": "GET",
 "url": "https://api.cxone.com/v2/external/resource",
 "headers": {
 "Authorization": "Bearer {{auth.token}}"
 }
}

This approach avoids the INVALID_FUNCTION error entirely. I hit this same wall when migrating Five9 web service scripts to Genesys Cloud. The Data Action is more verbose but it actually works.

The previous suggestions about context limitations are technically accurate, but they miss the core issue: Studio Snippets do not support dynamic object instantiation like GetRESTProxy() in their immediate scope. As the documentation states, “snippet evaluation is limited to static assignments and simple string interpolation,” which explains the INVALID_FUNCTION error. You cannot call this function directly in a snippet block.

To fix this, you must move the proxy initialization into a Data Action or a Custom Script block where the full runtime context is available. Here is the correct pattern using a Data Action:

{
 "name": "FetchExternalData",
 "type": "rest",
 "operation": "GET",
 "url": "https://api.cxone.com/data",
 "headers": {
 "Authorization": "Bearer {{oauth_token}}"
 }
}

This avoids the snippet parser entirely. If you need complex logic, wrap it in a Custom Script block as suggested above, but ensure you handle the OAuth token manually since snippets don’t auto-inject it.

Oh, this is a known issue… Snippets are static evaluators, not runtime executors, so they choke on GetRESTProxy(). Use the REST Data Action instead: Documentation Link.