How to get referencing table of given table using REST API?

vamshi14
Tera Contributor

Hi 

 

I have a case in which I need to pull the children tables (referencing tables) of a given table using an API. ServiceNow has this mechanism in UI (screenshot attached), I need similar thing through APIs.

 

Appreciate your help!!

 

@Ankur Bawiskar 

8 REPLIES 8

Hey, Thanks for your answer. 
But, this is not what I am looking for. This API tells about table extensions only. Also, this doesn't belong to REST API.

Hi,


You would need to build your own scripted rest web service to fulfill the data needs for this use case.

 

A quick googling gives you this example of a tool that uses the getTableExtension() function from the 

GlideTableHierarchy API. This might give you some ideas on how to proceed with your own code. 

 

BR, Jan

 

Example 

I traced the code that is triggered when you open the Entity Relationship Diagram. It points to this Script Include on the system: 

 

ERDProcessor /sys_script_include.do?sys_id=5de8f42137130000dadaa3549dbe5daa

 

"This script defines an AJAX processor that returns the GraphML (for Schema Map V3) of a specified database table.
Parameters define what is rendered.
The output also contains client-side
javascript for navigation and browsing."

 

This could be helpful if you end up building your own API. Just parse the needed information as text to output.

 

JCMoller_0-1675977428654.png

 

BR, Jan

 

@JC Moller ty very much for posting this. I will be leveraging this in my solution to build a graph for a scoped app, here is the solution if you are interested to know further

anilvaranasi/creativeworks: Contains application called awesomenowcreativeworks