You should probably look at at the REST Proxy configuration in NICE CXone. Studio snippets cannot call external APIs directly. They require a pre-configured proxy resource. The error occurs because GetRESTProxy expects a proxy ID or name, not a raw URL.
Create a REST Proxy in NICE CXone Studio.
Set the target URL to https://api.cxone.com/v2/customobjects/basic/contact.
Configure the HTTP method as POST.
In your snippet, reference the proxy by its unique ID.
// Correct usage
var proxyId = "rest-proxy-123"; // Replace with your actual proxy ID
var rest = GetRESTProxy(proxyId);
// Set payload
rest.setPayload(JSON.stringify({"fields": {"name": "Test"}}));
// Execute
var response = rest.execute();
Ensure the proxy has the correct OAuth scopes. Direct URL calls fail because the platform blocks outbound HTTP requests from snippets for security. Use the proxy to handle authentication and routing.
This looks like a fundamental misunderstanding of the GetRESTProxy function signature. The error INVALID_FUNCTION is not about the URL syntax; it is because you are passing a raw string where the engine expects a resource identifier. Studio does not allow direct HTTP calls from snippets for security isolation. You must define the endpoint in the CXone platform first.
The suggestion above correctly identifies the need for a proxy, but here is the exact implementation pattern.
Create the REST Proxy in CXone Studio/Configuration.
Note the id or name of that resource.
Use that identifier in the snippet.
// Incorrect
Set rest = GetRESTProxy("https://api.cxone.com/v2/customobjects/basic/contact")
// Correct
Set rest = GetRESTProxy("MyContactProxy")
Set payload = {"fields": {"name": "Test"}}
Set response = rest.post(payload)
Ensure the proxy has the correct OAuth scopes attached. If you get a 403 after fixing the function call, check the proxy’s authentication profile.
Check your REST Proxy configuration. The documentation states, “The proxy ID is used to reference the resource in snippets.” Passing a raw URL fails because the engine expects the unique identifier assigned during proxy creation. Use that ID in GetRESTProxy("your-proxy-id") instead of the endpoint URL.
Note: Ensure the proxy has the correct OAuth scope configured.
The problem here is conflating the endpoint URL with the proxy identifier. GetRESTProxy does not accept a string URL; it requires the specific id or name of a REST Proxy resource already defined in your CXone Studio environment. Passing "https://api.cxone.com/..." fails because the engine searches for a proxy resource with that exact name, which obviously does not exist.
First, navigate to your Studio application settings and create a new REST Proxy. Set the target URL to https://api.cxone.com/v2/customobjects/basic/contact. Configure the method as POST and ensure the authentication type matches your integration context (usually OAuth 2.0). Once created, note the id assigned to this proxy, for example prx_12345.
In your snippet, replace the URL string with this ID:
Set rest = GetRESTProxy("prx_12345")
Set payload = {"fields": {"name": "Test"}}
Set response = rest.Post(payload)
This approach isolates network configuration from business logic, adhering to CXone’s security model. If you are using a dynamic environment, you might store the proxy ID in an environment variable to avoid hardcoding. Also, verify that the proxy has the necessary scopes to access the customobjects/basic/contact endpoint. The INVALID_FUNCTION error is strictly a lookup failure; the function exists, but the argument type or value is incorrect for the resource registry. Do not attempt to bypass this with direct HTTP calls; they will be blocked by the sandbox. Stick to the proxy abstraction for all external API interactions from within Studio snippets.