The CreatorCon Call for Content is officially open! Get started here.

Can't insert cmdb_ci_storage_volume CI via CMDB Instance API

Henrik Jutterst
Tera Guru

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.

1 ACCEPTED SOLUTION

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"
			
		}
	}
}

 

find_real_file.png

Part of response

find_real_file.png

 

View solution in original post

27 REPLIES 27

Wow, what a journey! But I think you finally nailed it! I got it to work on my side.

  • CI got inserted
  • Relations got added to CI

All done. Thank you very much!

You are very welcome 🙂

Henrik Jutterst
Tera Guru

I also got some good feedback from @charlieloza that you can generate payload in ServiceNow:

Generate and simulate payload execution using identification simulation