Scripted REST API not able to access request

Shaan2
Tera Contributor

I have created a Scripted REST API to get user criteria for a user.

The script I'm using is:

(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {

var queryParams = request.queryParams;

var userID = String(queryParams.user);

return new sn_uc.UserCriteriaLoader.getAllUserCriteria(userID);

})(request, response);

I'm passing the user id in the request, and I've added a custom ACL for this REST endpoint. The error I'm seeing when making a call to this endpoint is:

{"error":{"message":"Access to RESTAPIRequest from scope <app_scope> not allowed","detail":"Access to RESTAPIRequest from scope <app_scope> not allowed"},"status":"failure"}

What am I doing wrong here?

FWIW I have gotten this to work before, but I think I might be missing an extra step this time

6 REPLIES 6

Hi @jaheerhattiwale 

It is working after adding cross scope privilege. but why it is not working without cross scope privilege now , and previously it is working. I did not change anything regarding cross scope .

 

@Abhishek145 Cant say what's the exact issue as I don't know the whole scenario. But if your issue is resolved please mark as correct answer.

 

Thank you

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023