- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 02:56 PM
We have an integration pulling CIs from the cmdb_ci table and need the class name rather than the actual table which is returned when you get the value for the cmdb_ci.sys_class_name field.
Curious how to pull the class name (not table name) through a REST call.
getClassDisplayValue() method is used when scripting inside SNOW itself, but I can't seem to find out how to get that result through the API.
Thanks!
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 06:43 PM
You can add "sysparm_display_value=all" to your URL. Here is an example
Script
#!/bin/bash instance=******** username=******** password=******** sysid=a22be6f1dbfde7007c7e54f948961944 fieldnames=sys_id,name,manufacturer,sys_class_name base="https://$instance.service-now.com/api/now/table/cmdb_ci/$sysid" parms="sysparm_fields=$fieldnames&sysparm_display_value=all" url="$base?$parms" curl $url --request GET --user "$username:$password"
Output
{
"result": {
"sys_id": {
"display_value": "a22be6f1dbfde7007c7e54f948961944",
"value": "a22be6f1dbfde7007c7e54f948961944"
},
"name": {
"display_value": "b24-rtr-2",
"value": "b24-rtr-2"
},
"sys_class_name": {
"display_value": "IP Router",
"value": "cmdb_ci_ip_router"
},
"manufacturer": {
"display_value": "Cisco",
"link": "https://********.service-now.com/api/now/table/core_company/fc8318026fc8de002cc8186e6b3ee4ce",
"value": "fc8318026fc8de002cc8186e6b3ee4ce"
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 03:37 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 04:26 PM
Yes, the lable, or table name. It's stored on the sys_choice table but would like to access it through the API similarly to the way you get to it internally. Not sure that is possible though.
If there is not a simple solution I still would like to find out what the actual solution would be
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 05:51 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 06:30 PM
