
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-29-2019 12:36 PM
Trying to figure out Why I can insert a new from the GUI into cmdb_ci_storage_volume table without any relations, but when I try to do the same via API (see this thread https://community.servicenow.com/community?id=community_question&sys_id=20c5ed1ddbd7a3c0fa192183ca96...) I have to add relations.
Why is that so?
I want to use this CMDB API to get all functions and checks for input data and not just use table API.
Using Kingston at the moment.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2019 01:38 AM
I see there are some typos in the request body that you had tried earlier. Here is the one that is working for me in REST Client
Please use the following body and try again and also make sure that type and target sys_id's are valid
{
"attributes":
{
"name": "heju-test-20190204-008",
"fqdn": "heju-test-20190204-008",
"company": "d9efdcacdb4a620076fabc2ffe9619a8",
"location":"6b059335dbd18f0076fabc2ffe9619c9",
"storage_type": "LUN",
"last_discovered": "2019-01-21 08:33:29",
"short_description": "Here's a newly created storate volume ci related to computer Child created from ServiceNow API outbound - 8",
"object_id": "test2",
"volume_id":"test2",
"dns_domain": "blank-heju",
"ip_address": "10.14.121.124"
},
"source": "ServiceNow",
"depends_on":{
"inbound_relations" :
{ "type": "55c95bf6c0a8010e0118ec7056ebc54d",
"target":"00e0fc12db062f001c19b6bffe961931",
"sys_class_name": "cmdb_ci_computer"
}
}
}
Part of response

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 07:08 AM
Still looking for an answer to this... Anyone with feedback?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-01-2019 01:20 PM
As I explained above the request body must have
"object_id": "test",
"volume_id":"test"
Please add those to request body and try.
I was able to create in my instance without any issue by passing values to object and volume id's

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2019 02:26 PM
Did you get a change to test it using object and volume ids

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 12:50 AM
Here's the feedback.
Please try the code your-self, but this does not solve the issue..
body:
{
"attributes":
{
"name": "heju-test-20190204-001",
"fqdn": "heju-test-20190204-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",
"object_id": "test",
"volume_id":"test",
"disk_space": "4000"
},
"source": "ServiceNow",
"inbound_relations": [
{"rel_type" : "55c95bf6c0a8010e0118ec7056ebc54d", "target": "007d9d0cdb6a63401c19b6bffe96194c"}],
"outbound_relations": [
{"rel_type" : "5599a965c0a8010e00da3b58b113d70e", "target": "85a0df05db8be3408956f3d61d961921"}
]
}
Respons:
{
"error": {
"detail": "inbound relation provided with empty relation type and target sys id 007d9d0cdb6a63401c19b6bffe96194c",
"message": "Invalid Relation Entry"
},
"status": "failure"
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 04:32 AM
I thought your earlier requirement was without relations. If it is then try the below request body
{
"attributes":
{
"name": "heju-test-20190204-001",
"fqdn": "heju-test-20190204-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",
"object_id": "test",
"volume_id":"test",
"disk_space": "4000"
},
"source": "ServiceNow"
}