添加配置项的关系



要添加配置项的关系,可使用以下URL:

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

假设AssetExplorer 运行在本地服务器的8080端口(服务器名为"localhost",端口号为 "8080"),则示例URL为:

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


关键参数:

  1. 操作名称 - 属性名称为:"OPERATION_NAME",值为:"add"。

  2. 技术员密钥 - 属性名称为:"TECHNICIAN_KEY",值为:密钥的值。


注意:  

  • 参数 结果格式(format - 可选项),用于指定返回信息的格式(值为xml或者json )

  • 如果不指定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>

 



Copyright © 2015 卓豪(北京)技术有限公司版权所有