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 CIs

Allen Allbrook, a CMDB configuration manager with Calbro Software Services wants to view all computer systems starting with name 'clm' in the production dataset.

He uses the following REST API:

/cmdb/v1.0/instances/{datasetId}/{namespace}/{className}


The following example demonstrates a sample request and its response: 

Sample Request

/api/cmdb/v1.0/instances/BMC.ASSET/BMC.CORE/BMC_ComputerSystem?num_matches=true&qualification='Name' LIKE "clm%"&limit=10&offset=0&attributes=Name,ClassId,DatasetId,InstanceId,ShortDescription

Sample Response

Response
{
"instances": [
{
"instance_id": "OI-3F7D1F0AA77346648F8109D160EC8698",
"class_name_key": {
"name": "BMC_ComputerSystem",
"namespace": "BMC.CORE"
},
"dataset_id": "BMC.ASSET",
"attributes": {
"InstanceId": "OI-3F7D1F0AA77346648F8109D160EC8698",
"ClassId": "BMC_COMPUTERSYSTEM",
"Name": "asset comp2",
"DatasetId": "BMC.ASSET",
"ShortDescription": "asset comp2"
},
"_links": {
"self": [
{
"href": "http://
<jetty host name>
:8008/api/cmdb/v1.0/instances/BMC.ASSET/BMC.CORE/BMC_ComputerSystem/OI-3F7D1F0AA77346648F8109D160EC8698"
}
]
}
},
{
"instance_id": "OI-3DF5218C9C374E84995964293A12480A",
"class_name_key": {
"name": "BMC_ComputerSystem",
"namespace": "BMC.CORE"
},
"dataset_id": "BMC.ASSET",
"attributes": {
"InstanceId": "OI-3DF5218C9C374E84995964293A12480A",
"ClassId": "BMC_COMPUTERSYSTEM",
"Name": "asset ci 01",
"DatasetId": "BMC.ASSET",
"ShortDescription": "asset ci 01"
},
"_links": {
"self": [
{
"href": "http://
<jetty-host-name>
:8008/api/cmdb/v1.0/instances/BMC.ASSET/BMC.CORE/BMC_ComputerSystem/OI-3DF5218C9C374E84995964293A12480A"
}
]
}
}  
],
"num_matches": 2
}

 

Do you want to learn more?

Learn about more things you can do with the REST API in Endpoints in the REST API.



Was this page helpful? Yes No Submitting... Thank you

Comments