要添加 CI 之间的关系,请使用以下格式:
http://<hostname>:<portnumber>/api/cmdb/cirelationships
假设您要在端口号为 8080 的本地服务器中添加 CI 之间的关系,URL 应为:
http://localhost:8080/api/cmdb/cirelationships
关键字:
输入是一个 XML 字符串,作为 “POST attribute ”发送,关键字为 “INPUT_DATA”。
操作名称 “add ”应作为 “POST attribute ”发送,关键字为 “OPERATION_NAME”。
技术员密钥应以 “POST attribute”的形式发送,其关键字为 “TECHNICIAN_KEY”。
注意: 如果未指定结果格式,API 将以 JSON 格式返回输出。
|
<?xml version="1.0" encoding="UTF-8"?>
<API version="1.0" locale="en">
<records>
<relationships>
<addrelationship>
<toci>balaguru.zohocorpin.com</toci>
<relationshiptype>Connected to</relationshiptype>
<relatedcis>
<citype>Printer</citype>
<ci>
<name>DLF11thFloor-I.csez.zohocorpin.com</name>
<relationattributes>
<attribute>
<name>AMC</name>
<value>5789</value>
</attribute>
<attribute>
<name>Maintained By</name>
<value>IT Department</value>
</attribute>
</relationattributes>
</ci>
<ci>
<name>firstfloor.zohocorpin.com</name>
<relationattributes>
<attribute>
<name>AMC</name>
<value>3789</value>
</attribute>
<attribute>
<name>Maintained By</name>
<value>IT Department</value>
</attribute>
</relationattributes>
</ci>
</relatedcis>
</addrelationship>
</relationships>
</records>
</API>
将一个 CI 与多个 CI 类型相关联的输入 XML 示例:
<?xml version="1.0" encoding="UTF-8"?>
<API version="1.0" locale="en">
<records>
<relationships>
<addrelationship>
<toci>balaguru.zohocorpin.com</toci>
<relationshiptype>Connected to</relationshiptype>
<relatedcis>
<citype>CPU Cores</citype>
<ci>
<name>rack-012W23</name>
</ci>
</relatedcis>
<relatedcis>
<citype>Disks</citype>
<ci>
<name>disk-01123</name>
</ci>
</relatedcis>
<relatedcis>
<citype>Processors</citype>
<ci>
<name>Dual-Core-Procesor-011212</name>
</ci>
</relatedcis>
</addrelationship>
</relationships>
</records>
</API>