添加配置项关系

要添加配置项之间的关系,请使用以下格式:

http://<hostname>:<portnumber>/api/cmdb/cirelationships

假设您要在本地服务器的端口号为8080的配置项之间添加关系,则URL应为:

http://localhost:8080/api/cmdb/cirelationships

关键点:

  1. 输入是以密钥"INPUT_DATA"作为"POST attribute"发送的XML字符串。

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

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

注意事项

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

  • 参数Result Format - Optional指定返回格式(XML或JSON),如果未指定返回格式,则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>