要添加配置项的关系,可使用以下URL:
http://<servername>:<portnumber>/api/cmdb/cirelationships
假设AssetExplorer 运行在本地服务器的8080端口(服务器名为"localhost",端口号为 "8080"),则示例URL为:
http://localhost:8080/api/cmdb/cirelationships
关键参数:
操作名称 - 属性名称为:"OPERATION_NAME",值为:"add"。
技术员密钥 - 属性名称为:"TECHNICIAN_KEY",值为:密钥的值。
|
注意:
如果不指定format参数,则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>
将某个配置项与多个配置项类型间建立关系:
<?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>