要获取配置项之间的关系,使用以下URL:
http://<servername>:<portnumber>/api/cmdb/cirelationships/CI Name/
假设您的AssetExplorer运行在本地服务器的8080端口,则示例URL为:
http://localhost:8080/api/cmdb/cirelatiionships/CI Name/
关键参数:
操作名称 - 属性名称为:"OPERATION_NAME",值为:"read"。
技术员密钥 - 属性名称为:"TECHNICIAN_KEY",值为:密钥的值。
|
注意:
如果不指定该参数,则API将返回JSON 格式的结果。 |
获取配置项关系的XML格式的输出示例:
<?xml version="1.0" encoding="UTF-8"?>
<API version="1.0">
<response>
<result>
<statuscode>200</statuscode>
<status>Success</status>
<message>Successfully fetched.</message>
<created-date>Mar 22, 2013 12:10 PM</created-date>
<relationships for="sdpvm-w2k8.zohocorpin.com.">
<relationship>
<name>Managed by</name>
<ci>
<type>Technician</type>
<name>Charles</name>
<relattributes/>
</ci>
</relationship>
<relationship>
<name>Runs</name>
<ci>
<type>Operating System</type>
<name>Microsoft® Windows Server® 2008 Standard (sdpvm-w2k8.zohocorpin.com.)</name>
</ci>
</relationship>
<relationship>
<name>Uses</name>
<ci>
<type>Storage Device</type>
<name>san-1</name>
</ci>
</relationship>
<relationship>
<name>Hosts</name>
<ci>
<type>IT Service</type>
<name>E-mail</name>
<relattributes/>
</ci>
</relationship>
</relationships>
</result>
</response>
</API>
获取配置项关系的 JSON 格式输出示例:
Note: Please note that the Input and Output XML formats have been changed.
{
"API": {
"response": {
"result": {
"created-date": "Sep 2, 2013 01:09 PM",
"message": "Successfully fetched.",
"status": "Success",
"statuscode": "200",
"relationships": {
"relationship": {
"ci": {
"type": "Operating System",
"relattributes": {
"attribute": [
{
"value": "-",
"name": "Installed On"
},
{
"value": "-",
"name": "Version"
},
{
"value": "-",
"name": "Installation Location"
}
]
},
"name": "Microsoft® Windows Server® 2008 Standard (sdpvm-w2k8.zohocorpin.com.)"
},
"name": "Runs"
},
"for": "sdpvm-w2k8.zohocorpin.com."
}
}
},
"operation": {
"name": "read"
},
"version": "1.0"
}
}