Skip to content

CI Relationship

Defines how one CI is connected to another CI. CI to CI relationships can be either custom or suggested.

Get List Of Ci Relationship

This operation helps to get all the relationships of the CI.

Url

<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships

$ curl -G <service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships\
      -X GET\ 
      -H "Accept: application/vnd.manageengine.sdp.v3+json"\
      -H "Authorization: Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"\
      -H "Content-Type: application/x-www-form-urlencoded"
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
           "Content-Type": "application/x-www-form-urlencoded",
           "Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
response = invokeurl
[
    url: url
    type: GET
    headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
    "Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
    "Content-Type" = "application/x-www-form-urlencoded"}
$response = Invoke-RestMethod -Uri $url -Method get -Headers $headers 
$response
#Python version - 3.8
#This script requires requests module installed in python.
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import urlopen,Request

url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json", 
          "Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx", 
          "Content-Type" : "application/x-www-form-urlencoded"}
httprequest = Request(url, headers=headers)
try:
    with urlopen(httprequest) as response:
        print(response.read().decode())
except HTTPError as e:
    print(e.read().decode())
{
 "response_status": [
    {
        "status_code": 2000,
        "status": "success"
    }
 ],
 "list_info": {
    "has_more_rows": false,
    "row_count": 1
 },
 "ci_relationships": [
    {
        "related_ci": {
            "ci_type": {
                "api_plural_name": "ci_computer",
                "name": "ci_computer",
                "display_name_plural": "Computer",
                "id": "100000000000030038",
                "display_name": "Computer",
                "icon_name": "exchange_server"
            },
            "name": "New Sample CI",
            "id": "100000000000033079",
            "relationship_count": 1
        },
        "is_inverse": false,
        "citype_relationship": null,
        "relationship_type": {
            "name": "Connected to",
            "description": "Relationship between items that is Connected",
            "id": "100000000000030604",
            "inverse_name": "Connected to"
        },
        "id": "100000000000033123",
        "related_citype": {
            "api_plural_name": "ci_computer",
            "name": "ci_computer",
            "display_name_plural": "Computer",
            "id": "100000000000030038",
            "display_name": "Computer",
            "icon_name": "exchange_server"
        }
    }
 ]
}

Add Custom Relationship Between Cis

This operation allows to add a custom relationship to a CI

Url

<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships

$ curl <service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships\
      -X POST\ 
      -H "Accept: application/vnd.manageengine.sdp.v3+json"\
      -H "Authorization: Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"\
      -H "Content-Type: application/x-www-form-urlencoded"\
      -d input_data='{
    "ci_relationship": {
        "relationship_type": {
            "id": "100000000000030604"
        },
        "related_ci": {
            "id": "100000000000032706"
        },
        "is_inverse": "false",
        "related_citype": {
            "id": "100000000000030038"
        }
    }
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
           "Content-Type": "application/x-www-form-urlencoded",
           "Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
    "ci_relationship": {
        "relationship_type": {
            "id": "100000000000030604"
        },
        "related_ci": {
            "id": "100000000000032706"
        },
        "is_inverse": "false",
        "related_citype": {
            "id": "100000000000030038"
        }
    }
};
params = {"input_data": input_data};
response = invokeurl
[
    url: url
    type: POST
    parameters: params
    headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json", 
          "Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx", 
          "Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
    "ci_relationship": {
        "relationship_type": {
            "id": "100000000000030604"
        },
        "related_ci": {
            "id": "100000000000032706"
        },
        "is_inverse": "false",
        "related_citype": {
            "id": "100000000000030038"
        }
    }
}
'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method post -Body $data -Headers $headers
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import urlopen,Request

url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json", 
          "Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx", 
          "Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
    "ci_relationship": {
        "relationship_type": {
            "id": "100000000000030604"
        },
        "related_ci": {
            "id": "100000000000032706"
        },
        "is_inverse": "false",
        "related_citype": {
            "id": "100000000000030038"
        }
    }
}'''
data = urlencode({"input_data":input_data}).encode()
httprequest = Request(url, headers=headers,data=data, method="POST")
try:
    with urlopen(httprequest) as response:
        print(response.read().decode())
except HTTPError as e:
    print(e.read().decode())
{
    "ci_relationship": {
        "comments": null,
        "related_ci": {
            "ci_type": {
                "id": "100000000000030038"
            },
            "name": "New Sample CI",
            "id": "100000000000032706"
        },
        "is_inverse": false,
        "citype_relationship": null,
        "relationship_type": {
            "name": "Connected to",
            "description": "Relationship between items that is Connected",
            "id": "100000000000030604",
            "inverse_name": "Connected to"
        },
        "id": "100000000000032712",
        "related_citype": {
            "api_plural_name": "ci_computer",
            "name": "ci_computer",
            "display_name_plural": "Computer",
            "id": "100000000000030038",
            "display_name": "Computer",
            "icon_name": "exchange_server"
        }
    },
    "response_status": {
        "status_code": 2000,
        "status": "success"
    }
}

Add Suggested Relationship Between Cis

This operation helps you to add a suggested relationship between 2 Configuration Items. Mandatory Fields are citype_relationship, related_ci

Url

<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships

$ curl <service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships\
      -X POST\ 
      -H "Accept: application/vnd.manageengine.sdp.v3+json"\
      -H "Authorization: Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"\
      -H "Content-Type: application/x-www-form-urlencoded"\
      -d input_data='{
   "ci_relationship":{
     "related_ci": {
            "id": "100000000000040001"
        },
        "citype_relationship": {
            "id": "100000000000041007"
        }
   }
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
           "Content-Type": "application/x-www-form-urlencoded",
           "Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
   "ci_relationship":{
     "related_ci": {
            "id": "100000000000040001"
        },
        "citype_relationship": {
            "id": "100000000000041007"
        }
   }
};
params = {"input_data": input_data};
response = invokeurl
[
    url: url
    type: POST
    parameters: params
    headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json", 
          "Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx", 
          "Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
   "ci_relationship":{
     "related_ci": {
            "id": "100000000000040001"
        },
        "citype_relationship": {
            "id": "100000000000041007"
        }
   }
}
'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method post -Body $data -Headers $headers
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.parse import urlencode
from urllib.request import urlopen,Request

url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}/ci_relationships"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json", 
          "Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx", 
          "Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
   "ci_relationship":{
     "related_ci": {
            "id": "100000000000040001"
        },
        "citype_relationship": {
            "id": "100000000000041007"
        }
   }
}'''
data = urlencode({"input_data":input_data}).encode()
httprequest = Request(url, headers=headers,data=data, method="POST")
try:
    with urlopen(httprequest) as response:
        print(response.read().decode())
except HTTPError as e:
    print(e.read().decode())
{
   "ci_relationship":{
      "created_time":{
         "display_value":"Aug 13, 2021 04:13 PM",
         "value":"1628851406903"
      },
      "comments":null,
      "related_ci":{
         "ci_type":{
            "id":"100000000000029962"
         },
         "name":"Application",
         "id":"100000000000040001"
      },
      "is_inverse":true,
      "created_by":{
            "email_id": "lincoln@zmail.com",
       "is_technician": true,
       "sms_mail": "linc123@xys_sms.co",
       "contact_info_id": "100000000000032677",
       "mobile": "9876543210",
       "last_name": "",
       "user_scope": "0",
       "phone": "",
       "name": "Lincoln",
       "id": "100000000000032679",
       "photo_url": "test-photo-url",
       "is_vip_user": false,
       "department": null,
       "first_name": "Lincoln",
       "job_title": ""
      },
      "citype_relationship":{
         "is_inverse":null,
         "name":"ci_application_100000000000030540_ci_computer",
         "id":"100000000000041007",
         "cardinality":"many_to_many"
      },
      "last_updated_by":null,
      "last_updated_time":null,
      "relationship_type":{
         "name":"Depends on",
         "description":"Relationship between items that Depends On and Used By",
         "id":"100000000000030540",
         "inverse_name":"Used by"
      },
      "id":"100000000000041015",
      "related_citype":{
         "api_plural_name":"ci_application",
         "name":"ci_application",
         "display_name_plural":"Application",
         "id":"100000000000029962",
         "display_name":"Application",
         "icon_name":"application"
      }
   },
   "response_status":{
      "status_code":2000,
      "status":"success"
   }
}