Get the user sys_id by usrname in REST API?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2019 12:38 AM
Hi,
I am trying to get the user's sys_id by using user's username. But I can find a proper way of implementing on API docs or in Google. I am using REST api to consume SNOW api. Guidance would highly appreciate.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2019 12:28 PM
Hello,
If you are querying the user table you can use the below (update with your values) to retrieve the users sys id using their username and a GET request:
https://<INSTNACE>.service-now.com/api/now/table/sys_user?sysparm_query%3Duser_name=<USERNAME>&sysparm_fields=sys_id&sysparm_limit=1
The response will look like so:
{
"result": [
{
"sys_id": "63991c152be65a00467e06d119da7777"
}
]
}
Hope this helps.
--David
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-21-2024 11:10 AM
The way that actually worked for me was:
https://<instance>.service-now.com/api/now/table/sys_user?sysparm_query=name%3D<name>&sysparm_fields=sys_id&sysparm_limit=1
{
"result": [
{
"sys_id": "3d0a93de93f63d50d5dab8786cba10c7"
}
]
}
Hope this works for anyone with this question.
Regards.