
- 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 05:55 AM
Thanks for feedback but sorry - no. I replaced the target..
IF you manage to get it to work. please upload json payload to this thread. Try on your side first and if you get it to work let me know.
But bear in mind that I want to use this API:
https://instance-name.service-now.com/api/now/cmdb/instance/cmdb_ci_storage_volume

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 06:38 AM
Below are the screenshots on REST API Explorer
Response Body
{
"result": {
"outbound_relations": [],
"attributes": {
"storage_type": "LUN",
"skip_sync": "false",
"operational_status": "1",
"lun": "",
"sharable": "false",
"sys_updated_on": "2019-02-04 12:43:37",
"discovery_source": "ServiceNow",
"first_discovered": "2019-01-29 21:13:52",
"sys_updated_by": "admin",
"due_in": "",
"media_type": "",
"sys_created_on": "2019-01-29 21:13:52",
"sys_domain": {
"display_value": "global",
"link": "https://dev10245.service-now.com/api/now/table/sys_user_group/global",
"value": "global"
},
"install_date": "",
"state": "",
"invoice_number": "",
"gl_account": "",
"sys_created_by": "admin",
"warranty_expiration": "",
"asset_tag": "",
"fqdn": "heju-test-20190204-001",
"change_control": "",
"vdisk_id": "",
"owned_by": "",
"checked_out": "",
"sys_domain_path": "/",
"disk_space": "4000",
"object_id": "test",
"maintenance_schedule": "",
"delivery_date": "",
"install_status": "1",
"size": "",
"cost_center": "",
"supported_by": "",
"dns_domain": "blank-heju",
"name": "heju-test-20190204-001",
"provided_by": "",
"assigned": "",
"delete_on_termination": "false",
"purchase_date": "",
"subcategory": "",
"device": "",
"short_description": "Here's a newly created CI created from ServiceNow API",
"size_bytes": "",
"volume_id": "test",
"assignment_group": "",
"managed_by": "",
"last_discovered": "2019-01-21 08:33:29",
"can_print": "false",
"sys_class_name": "cmdb_ci_storage_volume",
"manufacturer": "",
"mapping_type": "",
"sys_id": "2e95a8f90f5b6700e1f30dbce1050e14",
"file_system": "",
"po_number": "",
"computer": "",
"sys_class_path": "/!!/#8",
"checked_in": "",
"vendor": "",
"mac_address": "",
"company": {
"display_value": "",
"link": "https://dev10245.service-now.com/api/now/table/core_company/d9efdcacdb4a620076fabc2ffe9619a8",
"value": "d9efdcacdb4a620076fabc2ffe9619a8"
},
"model_number": "",
"justification": "",
"department": "",
"assigned_to": "",
"start_date": "",
"cost": "",
"comments": "",
"sys_mod_count": "1",
"serial_number": "",
"monitor": "false",
"label": "",
"model_id": "",
"ip_address": "10.14.121.124",
"sys_tags": "",
"volume_container": "",
"cost_cc": "USD",
"share_count": "",
"support_group": "",
"schedule": "",
"order_date": "",
"protected_by": "",
"due": "",
"correlation_id": "",
"unverified": "false",
"attributes": "",
"location": "",
"asset": "",
"category": "",
"fault_count": "0",
"free_space": "",
"free_space_bytes": "",
"lease_id": ""
},
"inbound_relations": [
{
"sys_id": "002442230f9fe300e1f30dbce1050ed2",
"type": {
"display_value": "Applicative Flow To::Applicative Flow From",
"link": "https://dev10245.service-now.com/api/now/table/cmdb_rel_type/85d98503ff100200d699ffffffffff8c",
"value": "85d98503ff100200d699ffffffffff8c"
},
"target": {
"display_value": "ThinkStation S20",
"link": "https://dev10245.service-now.com/api/now/cmdb/instance/cmdb_ci/01a9ec0d3790200044e0bfc8bcbe5dc3",
"value": "01a9ec0d3790200044e0bfc8bcbe5dc3"
}
},
{
"sys_id": "1c6de9230f5fe300e1f30dbce1050ecf",
"type": {
"display_value": "Applicative Flow To::Applicative Flow From",
"link": "https://dev10245.service-now.com/api/now/table/cmdb_rel_type/85d98503ff100200d699ffffffffff8c",
"value": "85d98503ff100200d699ffffffffff8c"
},
"target": {
"display_value": "ThinkStation S20",
"link": "https://dev10245.service-now.com/api/now/cmdb/instance/cmdb_ci/01a9ec0d3790200044e0bfc8bcbe5dc3",
"value": "01a9ec0d3790200044e0bfc8bcbe5dc3"
}
}
]
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 06:53 AM
Thanks for the feedback dvp!
Can you just explain to me what the different sys_id are? Where do they come from?
"type"
"target"
So that I can dubble check on my side and get my own sys_id and try it out.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 07:02 AM
"type" : It is the sys_id of relationship type (cmdb_rel_type).
"target": Sys_id of the record in cmdb_ci_computer.
Lets say you want to relate Storage volume and Computer record,
With inbound relation Computer is a parent and Storage volume appears as child in cmdb_rel_ci table
For outbound relation Computer is a child and Storage volume appears as parent in cmdb_rel_ci table
Hope this helps!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 07:08 AM
Let me try it out in a couple of hours. Thanks a lot fot the help!