How to get child records from parent record from api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 02:56 AM
Hi All,
I had requirement like i have an parent table rest api we want child table records in the same api can we achieve this!!
Thanks
Chandu Telu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 03:03 AM
For "child table" records, you can't do it in same API call. You need to use another API call. What you need is, reference record data, you can achieve using dot-walking in same API call.
Dot-Walking in the REST Table API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 03:07 AM
Hi ram,
By using dot walking we can get the single record.But i want all child table records
Thanks
Chandu
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2016 03:23 AM
Hi Chandu,
Generally a parent record will have many child records, in turn they might have many more. So, generally web applications, will not return child records data, while getting record details. For that you need to make another API call. Suppose, once you get an user details, to get his groups, you need to make another API call like below.
For example:
To get details of an user with username "admin"
https://devxxxx.service-now.com/api/now/v1/table/sys_user?sysparm_query=user_name=admin
To get details of an user groups with username "admin", we will take "sys_id" from above call and make another call.