- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 01:24 PM
I'm querying alm_asset table using API, there are some reference field that show the API link to that particular referenced table. Is there an easier way to construct the initial URL to also gather the field I want from the referenced table? Or do I have to re-query that referenced table to get the information I need?
For example. alm_asset table has reference field of model_category that links to cmdb_model_category. Currently, I need the cmdb_model_category.name to gather the name of the model_category. So what I'm doing is...
1. Query the alm_asset table, rest returns json with {'model_category: {'link': 'https://company.service-now.com/api/now/table/cmdb_model_category/1a84fd9sf4dsfaf94ds984fd9s', 'value': '1a84fd9sf4dsfaf94ds984fd9s'}}
2. So in my code, I'm re-querying that model_category link to look for the 'name' field.
This is taking very long time because for each alm_asset row, I'm re-querying reference table three times to gather all the information I need for this API call.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 01:49 PM
HI,
You can try dot walking to achieve this without the need to re-queriyng the referenced tables.
A nice blog on this topic - https://developer.servicenow.com/blog.do?p=/post/dot-walking-in-the-rest-table-api-2/#:~:text=Dot%2D...
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Muhammad

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-19-2022 01:49 PM
HI,
You can try dot walking to achieve this without the need to re-queriyng the referenced tables.
A nice blog on this topic - https://developer.servicenow.com/blog.do?p=/post/dot-walking-in-the-rest-table-api-2/#:~:text=Dot%2D...
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-30-2022 08:29 AM
Thanks that worked.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2022 09:00 PM
Hi t_h,
You can set the parameters of your API to send the display value of the reference field. On the REST API Explorer under query parameters look for sysparm_display_value.