Get Specific Relationship for CI



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

http://<servername>:<portnumber>/api/cmdb/cirelationships/CI Name/<Relationship Type>

Assuming you are to fetch 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/CI Name/Charles/Uses


Keypoints:

  1. The operation name "read"  should be sent as a "POST attribute" with key "OPERATION_NAME".

  2. 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:  

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

  • Relationship Type - Mandatory. Relationship type name can be case insensitive.


Sample XML Output for Read Specific Relationship for CI

<?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:57 PM</created-date>
                           <relationships for="Charles">
                                  <relationship>
                                  <name>Uses</name>
                                      <ci>
                                         <type>Server</type>
                                        <name>opman-solaris1.csez.zohocorpin.com</name>
                                        <relattributes/>
                                      </ci>
                                <relationship>
                           </relationships>
              </result>
    </response>
</API>


Sample JSON Output for Read Specific Relationship for CI

{
    "API": {
        "response": {
            "result": {
                "created-date": "Sep 2, 2013 02:59 PM",
                "message": "Successfully fetched.",
                "status": "Success",
                "statuscode": "200",
                "relationships": {
                    "relationship": {
                        "ci": {
                            "type": "Mac Workstation",
                            "relattributes": {},
                            "name": "sdp-imac.csez.zohocorpin.com"
                        },
                        "name": "Uses"
                    },
                    "for": "Charles"
                }
            }
        },
        "operation": {
            "name": "read"
        },
        "version": "1.0"
    }
}


SeviceDeskPlus - 帮助台和资产管理软件
Copyright © 2006-2017 卓豪(北京)技术有限公司版权所有