Getting table field and datatype using api
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2012 02:34 AM
How can I get table field and datatype using api?
For example,if I want to get all fields and datatype of incident table using api then is there any option to do that??
- Labels:
-
Integrations
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2012 05:55 AM
You can query the system dictionary table with web services if you have the proper rights.
WSDL:
https://myinstance.service-now.com/sys_dictionary.do?WSDL
Then perform a "getRecords" query such as:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:sys="http://www.service-now.com/sys_dictionary">
<soapenv:Header/>
<soapenv:Body>
<sys:getRecords>
<name>{TABLE NAME GOES HERE}</name>
</sys:getRecords>
</soapenv:Body>
</soapenv:Envelope>
This will give you all of the fields on that table and any information on that field such as data type.
Field names are found in the "element" result. Data types are found in the "internal_type" element.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2012 06:15 AM
What type of rights should I have to make the query?
Thanks,
Sandip
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-17-2012 05:35 AM
It probably takes an admin role to do this. I wouldn't recommend an integration user having admin rights. I would create a new role for your integration. Then I would create a set of ACLs on that role that allow the reading of the sys_dictionary. Then apply that role to the user that you are using for your inbound integration calls.