How to get column metadata through rest api?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 02:57 PM
Hi,
In our application, we are using this url to get the metadata of columns in each table: https://{Instance}.service-now.com/{Table}.do?SCHEMA
It's kind of weird that this url is not documented anywhere.
Is it still valid? Can we still trust the data returned from this url?
If not, is there're any other ways we can get column metadata?
I still know that we can use https://{Instance}.service-now.com/api/now/doc/table/schema/{tablename} to get column information. But the information is pretty limited.
Actually 'https://{Instance}.service-now.com/{Table}.do?SCHEMA' gives more information like the length of the column and the relationship to other tables (if column is a foreign key).
That's why we used this one.
Thanks,
Gary.
- 7,747 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-15-2017 05:45 PM
Hello Jerry,
I understand that documentation on accessing Schema via REST is VERY limited, but rest assured it is still valid. Although there is very minimal documentation, it does exist.
Alternatively you could access the [sys_dictionary] table directly and query the table based on the "name" field.
ie. https://<instance_name>.service-now.com/api/now/table/sys_dictionary?sysparm_query=name%3Dincident
Kind regards,
Simon Liang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 02:24 PM
Hi Simon,
Thanks, this is very helpful, btw can you help me locate https://{Instance}.service-now.com/api/now/doc/table/schema/{tablename} in the document as well?
Thanks,
Jerry.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 10:11 PM
Hello Jerry,
Unfortunately I was unable to locate any documentation on "/api/now/doc/table/schema", nor was I able to locate the endpoint in the REST API Explorer. Since there is no official documentation, personally I would refrain from using it as if there are any changes it could potentially break your implementation.
Please use "?SCHEMA" or query against the table API for table [sys_dictionary].
Kind regards,
Simon Liang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-16-2017 08:16 AM