Populating related list through IRE API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-26-2023 11:07 AM - edited 06-26-2023 12:57 PM
I am trying to figure out how to populate a related list at the same time I insert two CIs via the IRE API. In my case, I am trying to list installed software (software) in the out-of-box "Software Installed" related list of a Windows Server (cmdb_ci_win_server) CI. It is my understanding that createOrUpdateCIEnhanced supports this operation through the referenceItems array.
The result of my POST command is that neither CI is being created let alone with a populated related-list.
The payload looks like this:
{
"items": [
{
"className": "cmdb_ci_win_server",
"values": {
"x_crit2_logicmonit_logicmonitor_id": 25164,
"cpu_manufacturer": null,
"u_hardware_generation": null,
"ram": 8161,
"serial_number": "4964",
"u_configuration_date": "2019-01-07",
"os_domain": "WORKGROUP",
"mac_address": "64:1F:6B:B0:2A:AB",
"x_crit2_logicmonit_logicmonitor_portal": "<portal name>",
"os_address_width": "64-bit",
"host_name": "server1",
"manufacturer": null,
"name": "server1",
"cpu_speed": "2400",
"os": "Microsoft Windows 10 Pro",
"workgroup": null,
"cpu_name": "Intel(R) Atom(TM) CPU C2758 @ 2.40GHz",
"os_version": "10.0.19045",
"company": "f6c016a0470ae910a69a1e8dd46d43c0",
"cpu_core_thread": "8",
"fqdn": null,
"virtual": false,
"cpu_core_count": "8",
"ip_address": "10.3.2.11"
},
"sys_object_source_info": {
"source_name": "LogicMonitor CMDB REST API",
"source_recency_timestamp": "6/26/2023 7:12:35 AM"
}
},
{
"className": "cmdb_ci_spkg",
"values": {
"version": "34001",
"x_crit2_logicmonit_logicmonitor_id": "1407",
"parent": 0,
"x_crit2_logicmonit_logicmonitor_portal": "<portal name>",
"name": "LogicMonitorCollector-server1",
"child": 1
},
"sys_object_source_info": {
"source_name": "LogicMonitor CMDB REST API",
"source_recency_timestamp": "\/Date(1687785155229)\/"
}
}
],
"referenceItems": [
{
"referenced": 0,
"referencedBy": 1,
"referenceField": "name"
}
]
}
When I removed the referenceItems array and switch from, "https://instance.service-now.com/api/now/identifyreconcile/queryEnhanced", to "https://instance.service-now.com/api/now/identifyreconcile", the CIs were created, but obviously, they are un-related.
The response from createOrUpdateCIEnhanced was:
{
"result": {
"items": [
{
"className": "cmdb_ci_win_server",
"operation": "INSERT",
"identificationAttempts": [
{
"info": "sys_object_source SKIPPED",
"identifierName": "",
"attemptResult": "SKIPPED",
"attributes": [
"source_name",
"source_native_key"
],
"hybridEntryCiAttributes": [],
"searchOnTable": "sys_object_source"
},
{
"identifierName": "Windows LM rule",
"attemptResult": "NO_MATCH",
"attributes": [
"x_crit2_logicmonit_logicmonitor_id",
"x_crit2_logicmonit_logicmonitor_portal"
],
"hybridEntryCiAttributes": [],
"searchOnTable": "cmdb_ci_win_server"
}
],
"info": [],
"errorCount": 0,
"warningCount": 0,
"markers": [],
"inputIndices": [
0
],
"mergedPayloadIds": []
},
{
"className": "cmdb_ci_spkg",
"operation": "INSERT",
"identificationAttempts": [
{
"info": "sys_object_source SKIPPED",
"identifierName": "",
"attemptResult": "SKIPPED",
"attributes": [
"source_name",
"source_native_key"
],
"hybridEntryCiAttributes": [],
"searchOnTable": "sys_object_source"
},
{
"identifierName": "Software",
"attemptResult": "NO_MATCH",
"attributes": [
"x_crit2_logicmonit_logicmonitor_id",
"x_crit2_logicmonit_logicmonitor_portal"
],
"hybridEntryCiAttributes": [],
"searchOnTable": "cmdb_ci_spkg"
},
{
"identifierName": "Software",
"attemptResult": "SKIPPED",
"attributes": [
"key"
],
"hybridEntryCiAttributes": [],
"searchOnTable": "cmdb_ci_spkg"
}
],
"info": [],
"errorCount": 0,
"warningCount": 0,
"markers": [],
"inputIndices": [
1
],
"mergedPayloadIds": []
}
],
"additionalCommittedItems": [],
"relations": [],
"additionalCommittedRelations": [],
"hasError": false,
"hasWarning": false
}
}
There are no errors in the output and nothing from the identification engine at all, in the system logs when I use createOrUpdateCIEnhanced. What could be wrong with this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-28-2023 12:05 PM
From my understanding of the doc is that referenceItems need to use internal_id for referenced and referencedBy, not indexs to refer to the items in your payload.
That said, I'm still having an issue myself with it... Wich I'm going to post about if I don't find someone else with the solution... 🙂 But I thougth I would share, in case you are still working on this.