How to get column metadata through rest api?

jerryt
Tera Contributor

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.

4 REPLIES 4

Simon46
ServiceNow Employee
ServiceNow Employee

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.



XML web service



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


jerryt
Tera Contributor

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.


Simon46
ServiceNow Employee
ServiceNow Employee

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


Chandu Telu
Tera Guru
Tera Guru

HI Jerry,


Check this link it may help you


Tables and columns metadata