Check if user has access to certain resources using ServiceNow REST API.

Tomasz8
Kilo Contributor

I have credentials of service now user.

Is there any way to check over REST API if this user has access to read/write operations on certain table? 

For read operation I can just request for resource and in case of insufficient privileges I have appropriate HTTP status code, but I still don't know if user can write.

Best regards, Tomasz Bar

  

10 REPLIES 10

What do you mean manage resources? 

Also your SNC admin is going to have to do some work on his end to allow an account to make a REST call to the instance.  The best you will be able to do is create everything in a Dev instance and then export the update set and have them import it and commit it.  But there are going to have to be some changes made to allow management of resources, even if its just apply roles to an account.

 

Tomasz8
Kilo Contributor

I create fully independent system that only communicates over REST API with Service Now. My system receives data from some resources and process it. I just want to save this data as records in ServiceNow in tables (eg. incident) using REST API.

Service Now admin role in this use case is to create "technical user" in Service Now and give this credentials to our system, but I don't want to force him to do any additional work. Credentials of this "technical user" are used to authenticate during process of modifying and creating records.

I just want to be sure that privileges of this "technical user" are sufficient to do this. So, my system need check somehow (assumes that I have technical user login and password, and table name) is "technical user" allowed to read/write on this table. 

Solution with scripted Rest service is would be sufficient if there is some way to register this endpoint over REST. 

Best regards, Tomasz

You can check it using Table API, but you might have to repeat couple of steps like

 

Run GET method to verify read capability

Run POST to insert a record, capture the sys_id.

Run PUT by passing the sys_id and update the specific field

Run GET and verify if the field is updated.

 

You can do what dvp is suggesting or you can build the REST service that will do the checking, put it in an update set then just ask them to install it.  That is a very simple task and will not require them to do much work and will prevent you from having to run a bunch of tests to see what permissions the user has each time.

You can build and test the whole thing with a developer instance if you wanted.

Tomasz8
Kilo Contributor

Thank you for your reply.
This is solution I implemented right now, but I do only first GET for record from table.

I also thought about modifying records, but in case when user has no rights to delete (but can write) then I leave this dummy data in table and this is not good. 

Best regards, Tomasz