
- 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-04-2019 01:38 PM
Ok, here goes..
First of all, thanks for all the help. I'm kind of new to this and some things are not that intuitive...
I run the code and I can create a linux server with inbound and/or outbound relations to other CIs.
But when I try the same for storage colume it just doesn't work and I can't really tell why.
I looked in CI Class Manager and used the preferred classes for relations, but still no luck.
Can you try using Postman and see if you can get it to work to create a Storage Volume CI so that a proper relation gets added to cmdb_rel_ci-table?
I really cant get my head arround what's wrong...
Here's the latest payload I try to submit (that also hav an error in it (pls also confirm the correct api url):
{
"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": "test",
"volume_id":"test",
"dns_domain": "blank-heju",
"ip_address": "10.14.121.124"
},
"source": "ServiceNow",
"depends_on":{ "inbound_relation" : {"target":"00e0fc12db062f001c19b6bffe961931","relation_type": "55c95bf6c0a8010e0118ec7056ebc54d" }}
"lookup": [],
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2019 01:51 PM
Couple of questions
- What is the lookup in request body?
- On which class the target record (
) is in?00e0fc12db062f001c19b6bffe961931

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 01:00 AM
Hi dvp!
The reference that I looked into was this one: https://docs.servicenow.com/bundle/london-application-development/page/integrate/inbound-rest/concep...
Here you can see the lookup statement and it's blank on their example. However, just copy paste the code into postman does not work and gives you error. I had to put quotes arround
"inbound_relation" :
to get it to parse. But I think that this line direct after source row is the one that needs to be there for storage device to work. After all, that's what it was complaining about for most of the time.
And to be honest, I really don't know the difference between that row and the second row where you can specify inbound or outbound relations.
The sys_id "
00e0fc12db062f001c19b6bffe961931
" is the sys_id of a ci in cmdb_ci_computer. The sys_id for the relations is "contains" since I wanted to have simular relations as the one suggested in CI Class Manager, for Storage Volume CIs.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-05-2019 01:05 AM
Can you try creating a Storage Volume CI using POST on https://instance-name.service-now.com/api/now/cmdb/instance/cmdb_ci_storage_volume with Postman?
Try as my example to create a Storage Volume CI that is related to a Computer CI with the "Contains" relation (stored in cmdb_rel_type table).
Please let me know and big thanks for all the effort in helping out!

- 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