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

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

So when it worked earlier what was the change you did now?

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

i was able to get it to work, had misconfigured something, thanks

Abhishek145
ServiceNow Employee
ServiceNow Employee

Hi Shaan

I am getting the same error while making call to the endpoint  for webhook.

previously it is working for me. can you please help, how you resolved this issue.

Thanks

jaheerhattiwale
Mega Sage
Mega Sage

@Shaan2 Try to add a cross scope privilege and check

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