GET operation via REST API - Can I return reference field not sys_user GUID or display value?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 08:02 AM
When performing a GET operation you should have the option of what field/s to return for a reference, i.e. instead of just either the GUID, or the Display Value but any field from the referenced table. For instance if you've added a reference to a user to a table from the sys_user table (e.g. adding an owner of an application to an application table) and when you retrieve the data via a Rest API, for the reference field you might not want either the sys_user GUID, or the display value, but the NT_ID.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-05-2017 08:04 AM
are you using the table API? You can use dot-walked fields there, like user.u_nt_id or something to that effect. So in the fields parameter, pass in user.u_nt_id and you will get that back in the result, assuming your reference field is called "user".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2020 01:07 PM
Instead of the response being
{
"user.u_nt_id" = "some_id"
}
Can we get something like -
{
"user": {
"u_nt_id" = "some_id"
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-04-2020 03:43 PM
If it is a new proposal and not a question, it would be better to post it to the "IDEA PORTAL".
https://community.servicenow.com/community?id=ideas_list&sysparm_module_id=enhancement_requests
If the question is whether is it possible to obtain reference field information using GET, specifying "sysparam_fields" will limit return fields to those specified.
For example, following will query the incident table and return information on the "assigned_to" field.
GET https://<ServiceNow instance>.service-now.com/api/now/table/incident?sysparm_fields=assigned_to&sysparm_limit=1
Returned value:
{
"result": [
{
"assigned_to": {
"link": "https://<ServiceNow instance>.service-now.com/api/now/table/sys_user/5137153cc611227c000bbd1bd8cd2007",
"value": "5137153cc611227c000bbd1bd8cd2007"
}
}
]
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2020 12:55 PM
It's more of a question. I wanted to know if in the response, instead of just getting the link and the value, if there is a way to get additional fields from the reference object, but within the same nested json structure where we get the `link` attribute.