Example of using the REST API to search for related CIs
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"}
"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"
}
}
]
}
"_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"
}
}
]
}
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*