Add CI Relationships

 

To add relationship between CIs, use the following format:

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

Assuming you are adding relationship between CIs in the local server with port number 8080, the URL should be given as::

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

 

Keypoints:

 

  1. Input is an XML string sent as "POST attribute" with key "INPUT_DATA".

  2. The operation name "add"  should be sent as a "POST attribute" with key "OPERATION_NAME".

  3. The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".

 

 

Note:  

If no result format specified then API will return output in JSON format.

  • Parameter Result Format - Optional. specifies the return format ( XML or JSON )

 

Adding a relationship between a workstation and a access point with relationship attributes.

 

 

<?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>


 

 

 

Sample Input XML for relating a CI to multiple CI Types:

 

 

<?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>