
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-21-2019 06:08 AM
I need some input on how to resolve an issue I have when I would like to add a CI via REST API.
I'm kind of new to REST API, and I don't know how to resolve this issue or where to see what is supposed to be submitted in my payload. (I'm using Postman for this purpose)
POST https://instance-name.service-now.com/api/now/cmdb/instance/cmdb_ci_storage_volume
{
"attributes": {
"name": "heju-test-20190121-001",
"fqdn": "heju-test-20190121-001",
"company": "d9efdcacdb4a620076fabc2ffe9619a8",
"location": "6b059335dbd18f0076fabc2ffe9619c9",
"storage_type": "LUUN",
"last_discovered": "2019-01-21 08:33:29",
"short_description": "Here's a newly created CI created from ServiceNow API",
"dns_domain": "blank-heju",
"ip_address": "10.14.121.124",
"disk_space": "4000",
"type": "Runs on::Runs",
"child": "0"
},
"source": "ServiceNow"
}
Response:
{
"result": {
"items": [
{
"sysId": "Unknown",
"identifierEntrySysId": "Unknown",
"errors": [
{
"error": "MISSING_DEPENDENCY",
"message": "In payload no relations defined for dependent class [cmdb_ci_storage_volume] that matches any containment/hosting rules: [cmdb_ci_storage_volume >> Contained by >> cmdb_ci_computer,cmdb_ci_storage_volume >> Owned by >> cmdb_ci_storage_cluster,cmdb_ci_storage_volume >> Hosted on >> cmdb_ci_logical_datacenter]. Add appropriate relations in payload for '{\"className\":\"cmdb_ci_storage_volume\",\"values\":{\"storage_type\":\"LUUN\",\"short_description\":\"Here's a newly created CI created from ServiceNow API\",\"fqdn\":\"heju-test-20190121-001\",\"ip_address\":\"10.14.121.124\",\"last_discovered\":\"2019-01-21 08:33:29\",\"disk_space\":\"4000\",\"type\":\"Runs on::Runs\",\"discovery_source\":\"ServiceNow\",\"name\":\"heju-test-20190121-001\",\"dns_domain\":\"blank-heju\",\"company\":\"d9efdcacdb4a620076fabc2ffe9619a8\",\"location\":\"6b059335dbd18f0076fabc2ffe9619c9\",\"child\":\"0\"}}'"
},
{
"error": "ABANDONED",
"message": "Too many other errors"
}
],
"identificationAttempts": []
}
],
"relations": [],
"logContextId": "c565f183db0f6f408956f3d61d961979"
}
}
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2019 05:19 AM
The question was resolved in this thread: https://community.servicenow.com/community?id=community_question&sys_id=3a1d1cb1db576700d6a102d5ca96...
Thanks for all the feedback!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2019 11:58 PM
Anyone here who can give me a hint on what's missing and what I can do to fix this using my main payload?
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2019 12:54 AM
This seems to be an example, but I can't find an example of what the actual code would look like:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-28-2019 01:32 AM
Code:
{
"attributes":
{
"name": "heju-test-20190128-001",
"fqdn": "heju-test-20190128-001",
"company": "d9efdcacdb4a620076fabc2ffe9619a8",
"storage_type": "LUN",
"last_discovered": "2019-01-21 08:33:29",
"short_description": "Here's a newly created CI created from ServiceNow API",
"dns_domain": "blank-heju",
"ip_address": "10.14.121.124",
"disk_space": "4000"
},
"source": "",
"inbound_relations": [
{"rel_type" : "5599a965c0a8010e00da3b58b113d70e", "target": "85a0df05db8be3408956f3d61d961921"}
]
}
Result:
{
"error": {
"detail": "inbound relation provided with empty relation type and target sys id 85a0df05db8be3408956f3d61d961921",
"message": "Invalid Relation Entry"
},
"status": "failure"
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-06-2019 12:14 PM
Hello,
Have you been able to resolve this?, if not, did you tried looking at the "Identification Simulation" module?,
its under Configuration > Identification/Reconciliation > Identification Simulation, it lets you generate the correct JSON structure with relations included, you can select a class and define example relationships
Hope this helps

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2019 05:17 AM
Hi and a BIG thank you for this post! The question finally got solved in another thread, but this will come in handy many times in the future!!
Have a great day, and once a again - thank you very much!