AssetExplorer

    Get Relationship between two CIs



    To read a specific relationship of a CI, use the following url:

    http://<servername>:<portnumber>/api/cmdb/cirelationships/CI Name 1<->CI Name 2/


    Assuming you are to read a specific relationship of a CI - example: server being used by a technician - available in the local server with port number 8080, the URL should be given as:

    http://localhost:8080/api/cmdb/cirelationships/connector.iad8.amazon.com<->dlf-1w.printer-1/


    Keypoints:

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

    2. The operation name "read"  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:  

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

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


    Mandatory Parameters:  

    • Symbol <-> between the two CIs is mandatory

    • CI Name1 - Mandatory. CI Name can be case insensitive.


    Sample XML Output for Relationship between two CIs: Here the webserver connector.iad8.amazon.com is connected with the  dlf-1w.printer-1 printer.

    <?xml version="1.0" encoding="UTF-8"?>
    <API version="1.0">
        <response>
                <result>
                    <statuscode>200</statuscode>
                    <status>Success</status>
                    <message>Successfully fetched.</message>
                    <created-date>Mar 22, 2013 12:51 PM</created-date>
                             <relationships for="connector.iad8.amazon.com">
                                       <relationship>
                                        <name>Connected to</name>
                                            <ci>
                                                  <type>Printer</type>
                                                   <name>dlf-1w.printer-1</name>
                                                   <relattributes/>
                                             </ci>
                                       </relationship>
                             </relationships>
                 </result>        
        </response>
    </API>

    Sample JSON Response:


    {
        "API": {
            "response": {
                "result": {
                    "created-date": "Sep 2, 2013 03:05 PM",
                    "message": "Successfully fetched.",
                    "status": "Success",
                    "statuscode": "200",
                    "relationships": {
                        "relationship": {
                            "ci": {
                                "type": "Switch Ports",
                                "name": "connector.iad8.amazon.com"
                            },
                            "name": "Connected to"
                        },
                        "for": "DLF11thFloor-I.csez.zohocorpin.com"
                    }
                }
            },
            "operation": {
                "name": "read"
            },
            "version": "1.0"
        }
    }

     

    Copyright © 2017, ZOHO Corp. All Rights Reserved.