获取CI关系详细信息

要读取配置项之间的关系,请使用以下URL格式:

http://<servername>:<portnumber>/api/cmdb/cirelationships/CI Name/

假设您正在获取端口号为8080的本地服务器中可用的两个配置项之间的关系,则URL应指定为:

http://localhost:8080/api/cmdb/cirelatiionships/CI Name/

关键点:

  1. 操作名"read"应通过密钥"OPERATION_NAME"作为"POST attribute"发送。

  2. 技术员密钥应通过密钥"TECHNICIAN_KEY"作为"POST attribute"发送。

注意事项

如果未指定结果格式,则API将以JSON格式返回输出

  • 参数Result Format - Optional指定返回格式(XML或JSON),如果未指定返回格式,则API将以JSON格式返回输出。


读取CI关系的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>


读取CI关系的JSON输出示例:


Note:Please note that theInputandOutput XMLformats 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"
}
}