- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 08:06 AM
My ServiceNow instance is in New York version, but we expect customers will use other versions too.
I am trying to get back a list of configuration items with details in each item using REST API. From my REST API Explorer, I use this REST API:
GET https://<ServiceNow instance>.service-now.com/api/now/cmdb/instance/cmdb_ci
The response is a list of configuration items with only "sys_id" and "name" for each configuration item.
A configuration item has a lot of info like category, location, own_by, assigned_to, etc.. Is there a REST API that I can get back the list of configuration items and each item contains all the info in addition to "sys_id" and "name"?
Thanks!
Solved! Go to Solution.
- Labels:
-
Integrations
-
Multiple Versions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 08:34 AM
Hi @Mei
The CMDB Instance API you are using will return only sys_id and name only as its default api and its not configurable.
You can give try for Table API and build it using Rest API Explorer module, in which you can send query and what fields you need in response you can configure it.
Below screen-shot shows that API you should give try in table name specify Configuration Item (cmdb_ci) & in sysparm_query field specify which record you need. While in sysparm_fields specify fields you need in response. Now when you click send button you will get link of your API which will be like this :
GET https://InstanceID.service-now.com/api/now/table/cmdb_ci?sysparm_query=sys_class_name%3Dcmdb_ci_netgear&sysparm_display_value=true&sysparm_fields=name%2Csys_id%2Ccategory%2Clocation%2Cowned_by%2Cassigned_to&sysparm_limit=10
and last response will be like this
{
"result": [
{
"sys_id": "10884798c61122750108b095e21e4080",
"name": "San Diego Gateway",
"location": {
"display_value": "4492 Camino De La Plaza, San Ysidro,CA",
"link": "https://InstanceID.service-now.com/api/now/table/cmn_location/f48b246e0a0a0ba700a6e9b44c99f102"
},
"owned_by": "",
"category": "Do not migrate to asset",
"assigned_to": ""
},
{
"sys_id": "108a9205c611227500786e160f9d343e",
"name": "DataNoc.gw01.lanset.net",
"location": {
"display_value": "3191 Grand Avenue, Coconut Grove,FL",
"link": "https://InstanceID.service-now.com/api/now/table/cmn_location/25ab92490a0a0bb30070567e7225ec2b"
},
"owned_by": "",
"category": "Do not migrate to asset",
"assigned_to": ""
} ]
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks & Regards,
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 08:34 AM
Hi @Mei
The CMDB Instance API you are using will return only sys_id and name only as its default api and its not configurable.
You can give try for Table API and build it using Rest API Explorer module, in which you can send query and what fields you need in response you can configure it.
Below screen-shot shows that API you should give try in table name specify Configuration Item (cmdb_ci) & in sysparm_query field specify which record you need. While in sysparm_fields specify fields you need in response. Now when you click send button you will get link of your API which will be like this :
GET https://InstanceID.service-now.com/api/now/table/cmdb_ci?sysparm_query=sys_class_name%3Dcmdb_ci_netgear&sysparm_display_value=true&sysparm_fields=name%2Csys_id%2Ccategory%2Clocation%2Cowned_by%2Cassigned_to&sysparm_limit=10
and last response will be like this
{
"result": [
{
"sys_id": "10884798c61122750108b095e21e4080",
"name": "San Diego Gateway",
"location": {
"display_value": "4492 Camino De La Plaza, San Ysidro,CA",
"link": "https://InstanceID.service-now.com/api/now/table/cmn_location/f48b246e0a0a0ba700a6e9b44c99f102"
},
"owned_by": "",
"category": "Do not migrate to asset",
"assigned_to": ""
},
{
"sys_id": "108a9205c611227500786e160f9d343e",
"name": "DataNoc.gw01.lanset.net",
"location": {
"display_value": "3191 Grand Avenue, Coconut Grove,FL",
"link": "https://InstanceID.service-now.com/api/now/table/cmn_location/25ab92490a0a0bb30070567e7225ec2b"
},
"owned_by": "",
"category": "Do not migrate to asset",
"assigned_to": ""
} ]
}
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks & Regards,
Viraj Hudlikar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-11-2021 09:02 AM
Hi
By the way, my REST API Explorer does not have cmdb_ci table. It needs to be cmdb_ci_<something>. But I can do:
GET https://<ServiceNow instance>/api/now/cmdb/instance/cmdb_ci?<sys_id>&sysparm_fields=....
This will get back the same result as yours.
Thanks again!