Powershell script RestAPI

ragz
Tera Expert

Hi ,

Using powershell scripts I need to insert data into INCIDENT table using REST API .

Please let me know how to achieve this ?

9 REPLIES 9

Dave Smith1
ServiceNow Employee
ServiceNow Employee


I believe I am having write access to the table as I am able to POST (add) the entry in incident table but only problem with updating the record .



Write access is needed to make changes (updates); create access is needed to add a new record (inserts) - so it's more likely you have create but not write.



However, your screen dump indicates this user has the itil role, which should permit inserts and updates.   Have you tried impersonating that user and seeing what you're able to add/change first?



Also: it's not a good idea to give them the itil role, since this is licenced and consumes a seat - it may be better to create a separate role with specific insert/update rights.


Yes ,   I am able make updates after impersonating the user (rest user) from UI   but I am getting the issue while running the powershell script to update the record .



The remote sever returned an error :   (403) Forbidden .


Dave Smith1
ServiceNow Employee
ServiceNow Employee

The remote sever returned an error : (403) Forbidden .


That would suggest the error lies with your PowerShell script.   Have you tried checking the URL it's constructing, testing that works in a browser?   Is the script writing any log lines out at all?


It is construction the correct URL why because as soon as I granted admin role to the user the record getting updated .


Hi Dave ,


This is a similar issue



https://community.servicenow.com/thread/246382