Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

REST API query for business services

ssoniy
Tera Contributor

We have 'VDI' business services and all CI's and all CI relationship related to this services.

I need to get the Correct query REST API for this service 'VDI' , so that all CIs & relationship (cmdb_ci and cmdb_rel_ci) for service will be linked to 3rd party dashboard.

How can we achieve this? can anyone please suggest.

3 REPLIES 3

santoshsahoonis
Kilo Guru

If I understand you requirement correctly, you want a REST GET call to return values from multiple tables(Here, cmdb and other related tables)



Easiest way to do this would be to setup a database view. Then use this table for the REST API calls.


Database Views - ServiceNow Wiki


i have used REST GET calling for the table 'cmdb_rel_ci' and to query the Service = VDI .


The REST endpoint i gave as   https://<instance_name>/api/now/table/cmdb_rel_ci_list.do?sysparm_query=GOTOparent.name%3DVDI&syspar...=



but getting error as HTTP 400 - The webpage cannot be found.


You are using wrong endpoint.



The EndPoint should be like this:


https://<instance_name>/api/now/table/cmdb_rel_ci?sysparm_query=GOTOparent.name%3DVDI&sysparm_view



Do not use tableName_list.do     ... You have to only use the name of the table.