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:
-
Input is an XML string sent as "POST attribute" with key "INPUT_DATA".
-
The operation name "add" should be sent as a "POST attribute" with key "OPERATION_NAME".
-
The technician key should be sent as a "POST attribute" with key "TECHNICIAN_KEY".
Notes:
-
Cannot add relationship attribute for software CI Type.
-
If any error thrown by API then the remaining relationship won't get added.
Mandatory parameters:
-
<relationships> - If not specified or empty tag then API will throw the error like '
tag cannot be empty.' with the code 3026. -
<addrelationship> If not specified or empty tag then API will throw the error like '
tag cannot be empty.' with the code 3026. -
<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.
-
<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.
-
<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. -
<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.
-
<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. -
<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.
-
<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).
Can specify more than one relationship using <addrelationship> tag.
Limitations:
-
Cannot add relationship attribute for software CI Type.
-
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>