REST API - User ID through User Reference?

Rom
Kilo Contributor

Hi everyone,

I'm trying to generate a GET request API which I already have working properly. However, I want my API's response to display the User ID of the requester (wherever there is a user reference) and not their full name. Is this possible through the REST API Explorer?

Thanks!

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rom,

yes you can get the user id column as well

sample endpoint here

GET:

URL: https://instanceName.service-now.com/api/now/table/incident?sysparm_query=number%3DINC0010207&sysparm_fields=caller_id.user_name

Response:

{
  "result": [
    {
      "caller_id.user_name": "george.grey"
    }
  ]
}

in the example: I am getting the caller's user_name i.e. User ID

you need to specify the field you want using sysparm_fields

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Rom,

yes you can get the user id column as well

sample endpoint here

GET:

URL: https://instanceName.service-now.com/api/now/table/incident?sysparm_query=number%3DINC0010207&sysparm_fields=caller_id.user_name

Response:

{
  "result": [
    {
      "caller_id.user_name": "george.grey"
    }
  ]
}

in the example: I am getting the caller's user_name i.e. User ID

you need to specify the field you want using sysparm_fields

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Thanks Ankur! I didn't realize that this was possible this way.

Rajbir
Kilo Explorer

I am unable to set the caller_id and assignment group. I using the npm package of servicenow-rest-api and thereby I calling the api for incident for creating the new incident. I can create any fields accept the caller_id and assignment group. How to achieve this?