
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-25-2018 11:49 PM
Hello community
We would like to import data from ServiceNow for evaluation purposes. The data should be loaded using the REST API.
Our security does not allow us to set up a user on production who can only log in with username+password, OAuth2 would be acceptable.
Is there a way to set up a service user who only has the right to load data from the ServiceNow using REST and OAuth2:
- The user is not allowed to login to the UI.
- The user is not allowed to make URL calls.
- The user is not allowed to log on with Basic Authentication.
I appreciate any inputs and support.
Many thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 02:02 PM
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var headers = request.headers;
var authHeader = headers.authorization;
if(authHeader.indexOf("Basic")> -1)
{
return { "response" : "Basic Authenctiaction is not supported"};
}
var requestBody = request.body;
var requestData = requestBody.data;
// Your code continues .......
})(request, response);
Hope this answer will atleast help you achieve some of your requirements.
Thank you,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2018 02:02 PM
(function process(/*RESTAPIRequest*/ request, /*RESTAPIResponse*/ response) {
var headers = request.headers;
var authHeader = headers.authorization;
if(authHeader.indexOf("Basic")> -1)
{
return { "response" : "Basic Authenctiaction is not supported"};
}
var requestBody = request.body;
var requestData = requestBody.data;
// Your code continues .......
})(request, response);
Hope this answer will atleast help you achieve some of your requirements.
Thank you,

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2018 02:15 AM
Hey Aman
Thank you very much for your detailed answer, this helps very much. Unfortunetly I am using OOB table API REST Calls. Do you think its possible to use a scripted REST Call, doing your code above, and after your comment "// Your code continues" using the OOB table API Calls?
For 2. I think we have tried that, we checked web services only and the user was still able to proceed URL Calls, but i'll check that again.
Thank you very much again for your help, I appreciate.
Regards
Roman
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2018 10:33 AM
Do you think its possible to use a scripted REST Call, doing your code above, and after your comment "// Your code continues" using the OOB table API Calls?
[Answer] It is possible, you can perform table reads and return the data you want in the JSON format from the scripted REST API Resource.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-31-2018 11:39 AM
I Wrote a new Article on how to Force OAuth2 on API Calls. Might help you in future.