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:
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 '
<addrelationship> If not specified or empty tag then API will throw the error like '
Can specify more than one relationship using <addrelationship> tag.
<toci> - Add relationship to the specified CI.
If no
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 '
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
<citype> - used to specify the relationship CI's type.
If not specified or empty tag then API will throw the error like '
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
<name> - to specify the relationship ci name
If no
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
If no
<name> and <value> - (mandatory)
If no tag or empty value is specified then the API will throw the error like 'Empty attribute
Unknown error will be thrown if invalid value is specified for the attribute(s).
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>