AssetExplorer

    Add CI Relationships



    To add relationship between CIs, use the following format:

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


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

    http://localhost:8080/sdpapi/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".

    Notes:

    1. Cannot add relationship attribute for software CI Type.

    2. If any error thrown by API then the remaining relationship won't get added.


    Mandatory parameters:

    1. <relationships> - If not specified or empty tag then API will throw the error like ' tag cannot be empty.' with the code 3026.

    2. <addrelationship> If not specified or empty tag then API will throw the error like ' tag cannot be empty.' with the code 3026.

    3. Can specify more than one relationship using <addrelationship> tag.

    4. <toci> - Add relationship to the specified CI.

      • If no tag or empty tag specified then the API will throw the error like ' tag cannot be empty.' with the code 3026.

      • If invalid CI name specified then API will throw the error like 'CI 'XYZ' is not found.' with the code 3021.

    5. <relationshiptype> - to specify the relationship type between two CI(s).

      • If not specified or empty tag then API will throw the error like ' tag cannot be empty.' with the code 3026.

      • if Invalid relationship type is specified then API will throw the error like 'No 'XYZ' relationship is defined between the CI 'ABC' and 'DEF'.' with the code 3021.

    6. <relatedcis> -  parent tag for the relationship CI(s)

      • If no tag or empty tag specified then the API will throw the error like ' tag cannot be empty.' with the code 3026.

    7. <citype> -  used to specify the relationship CI's  type.

      • If not specified or empty tag then API will throw the error like ' tag cannot be empty.' with the code 3026.

      • If invalid ci type is specified then the API will throw the error like 'CI Type 'Printer1' not found.' with the code 3021.

    8. <ci> - used to specify the relationship CI(s)

      • If no tag or empty tag specified then the API will throw the error like ' and tag cannot be empty.' with the code 3026.

    9. <name> - to specify the relationship ci name

      • If no tag or empty tag specified then the API will throw the error like ' and tag cannot be empty.' with the code 3026.

      • If invalid ci name is specified then the API will throw the error like 'CI 'XYZ' is not found.' with the code 3021.

      • If the relationship is already added for the CI then the API will throw the error like 'Relationship 'Connected to' is already added to 'XYZ'.' with the code 3024.

    10. <relationattributes> - Used to specify the relationship attributes

      • if no or empty tag is specified then the API won't throw any error.

      • <attribute> - (Mandatory).

      • If no tag or empty value is specified then the API will throw the error like 'Empty tag value specified.' with the code 3026.

      • <name> and <value> - (mandatory)

        If no tag or empty value is specified then the API will throw the error like 'Empty attribute or tag is specified.' with the code 3026.

        Unknown error will be thrown if invalid value is specified for the attribute(s).

    Limitations:

    1. Cannot add relationship attribute for software CI Type.

    2. If any error thrown by API then the remaining relationship won't get added


    Sample Input XML for adding a relationship between workstation and access point (using 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>

     


     

    Copyright © 2017, ZOHO Corp. All Rights Reserved.