I’m building a Studio snippet to fetch user profile data via the REST API, but I keep hitting an INVALID_FUNCTION error. I’ve got the snippet configured to accept a userId input. Here’s the code block:
var rest = GetRESTProxy("https://platform.niceincontact.com/api/v2/users/" + userId);
rest.SetHeader("Content-Type", "application/json");
rest.SetHeader("Authorization", "Bearer " + token);
var response = rest.Get();
The error points directly to the GetRESTProxy line. I’ve verified the base URL and the token variable is populated correctly earlier in the flow. I’ve also tried hardcoding a valid user ID just to rule out null input issues, but the error persists.
I know GetRESTProxy is supposed to handle the HTTP request, but the syntax feels off. Am I missing a specific parameter or is the endpoint format wrong for this proxy object? I’ve checked the CXone documentation and it’s pretty vague on the exact method signature for GET requests.
I’ve also tried using rest.Execute() but that just gives me a syntax error in the snippet editor. Anyone have a working example of a simple GET call using GetRESTProxy in a Studio snippet? I’ve been stuck on this for two hours.