This documentation supports the 20.02 version of BMC CMDB.

To view an earlier version, select the version from the Product version menu.

Example of using the REST API to search for related CIs

Allen Allbrook, a CMDB configuration manager with Calbro Software Services wants to view all the CIs related to the CS000000 instance of the BMC_ComputerSystem class. Allen does not know the exact data model path to follow in the query. Therefore, he uses the Graph Walk API in his program.

See, Graphwalk to search for related CIs.

The following example demonstrates a sample request and its response: 


Sample Request

/api/cmdb/v1.0/graphwalk?graph_walk_query={"limit":1000,"num_levels_to_traverse":2,
"query_mode":"STOP_IF_NO_MATCH_FOUND",
"default_return_relationship_ci_attributes":"ALL",
"default_return_class_ci_attributes":"ALL","default_return_class_cis":"ALL",


"relationship_selectors_filters":[{"class_name_key":
{"namespace":"BMC.CORE","name":"BMC_BaseRelationship"},
"direction_to_walk":"BOTH","return_attributes":["Name"]}],


"class_selectors_filters":[{"class_name_key":{"namespace":"BMC.CORE","name":"BMC_BaseElement"},
"return_attributes":
["Name"]}],


"start_node":{"class_name_key":{"namespace":"BMC.CORE","name":"BMC_ComputerSystem"},
"instance_id":"OI-48887AC411AF42E5A647D498F2690048"},


"dataset_id":"BMC.ASSET"}

Sample Response

Response
{
"_links": {
"self": [
{
"href": "http://localhost:8008/api/cmdb/v1.0/graphwalk"
}
]
},
"relationship_cis": [
{
"instance_id": "OI-2BD2E621041D4E5CAC8140831F7983AF",
"class_name_key": {
"name": "BMC_Component",
"namespace": "BMC.CORE"
},
"attributes": {
"Name": "rel_1568733692473"
}
},
{
"instance_id": "OI-7623E3DFBA6C42AFA43167384C72DBC8",
"class_name_key": {
"name": "BMC_Component",
"namespace": "BMC.CORE"
},
"attributes": {
"Name": "rel_1568734303705"
}
}
],
"class_cis": [
{
"instance_id": "OI-5694F326C3044801A82EC21B3279382C",
"class_name_key": {
"name": "BMC_DataBase",
"namespace": "BMC.CORE"
},
"attributes": {
"Name": "clm01
database"
}
},
{
"instance_id": "OI-D10E1AD6D03D407E878FEC181D604C4F",
"class_name_key": {
"name": "BMC_LAN",
"namespace": "BMC.CORE"
},
"attributes": {
"Name": "clm01
computer"
}
}
]
}
Was this page helpful? Yes No Submitting... Thank you

Comments