How to retrieve userid/name from GET requests using REST API

sabz
Kilo Explorer

I am building a .net core/c# app and using oauth with servicenow. I would like to fetch the user information such as a unique id and name from GET requests. Is there a way to do this ?

6 REPLIES 6

SanjivMeher
Kilo Patron
Kilo Patron

You can use the table api for this. For ex below end point give me a list of 10 user records

 

https://<your instance>.service-now.com/api/now/table/sys_user?sysparm_limit=10


Please mark this response as correct or helpful if it assisted you with your question.

Hi Sanjiv,

What about the id/name for the currently logged in user?

Then you will have to use transaction table

 

https://<instance>.service-now.com/api/now/table/v_transaction?sysparm_limit=1


Please mark this response as correct or helpful if it assisted you with your question.

I am getting this error when I try to access that url from a non admin account 

{
"error": {
"message": "User Not Authorized",
"detail": "User is unauthorized to access table: v_transaction"
},
"status": "failure"
}

 

This is my GET request 

https://<instance>.service-now.com/api/now/table/v_transaction?sysparm_limit=1

 

Is there something for a non admin account to be able to retrieve their user info?