CI Link CI
A CI can be linked with different entities like Asset, Site, Department, User, etc.
Linking A Ci
This operation helps you to link a CI to an existing entity like Asset, Department, Site, User, etc. Mandatory fields are linked_entity, linked_instance
Url
<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}
$ curl <service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}\
-X PUT\
-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_computer":{
"linked_entity":{
"name":"department",
"id":"100000000000004786"
},
"linked_instance": "100000000000005429"
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"ci_computer":{
"linked_entity":{
"name":"department",
"id":"100000000000004786"
},
"linked_instance": "100000000000005429"
}
};
params = {"input_data": input_data};
response = invokeurl
[
url: url
type: PUT
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}"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
"ci_computer":{
"linked_entity":{
"name":"department",
"id":"100000000000004786"
},
"linked_instance": "100000000000005429"
}
}
'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method put -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}"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"ci_computer":{
"linked_entity":{
"name":"department",
"id":"100000000000004786"
},
"linked_instance": "100000000000005429"
}
}'''
data = urlencode({"input_data":input_data}).encode()
httprequest = Request(url, headers=headers,data=data, method="PUT")
try:
with urlopen(httprequest) as response:
print(response.read().decode())
except HTTPError as e:
print(e.read().decode())
{
"ci_computer":{
"linked_instance":"100000000000005429",
"created_time":{
"display_value":"Aug 13, 2021 02:58 PM",
"value":"1628846921920"
},
"attachments":[
],
"ci_attributes":{
"txt_installation_path":null,
"ref_owned_by":null,
"txt_location":null,
"txt_version":null,
"ref_managed_by":null,
"ref_business_impact":null,
"date_installed_on":null,
"txt_license_key":null
},
"description":null,
"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": ""
},
"data_source":[
],
"last_updated_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": ""
},
"ci_type":{
"api_plural_name":"ci_computer",
"name":"ci_computer",
"display_name_plural":"Computer",
"id":"100000000000029962",
"display_name":"Computer",
"icon_name":"computer"
},
"linked_entity":{
"api_plural_name":"departments",
"name":"department",
"display_name_plural":"sdp.module.pluralname.departments",
"id":"100000000000004786",
"display_name":"Department",
"icon_name":null
},
"last_updated_time":{
"display_value":"Aug 13, 2021 05:15 PM",
"value":"1628855125037"
},
"linked_instance_data":{
"site":null,
"name":"IT Services",
"id":"100000000000005429"
},
"name":"Computer",
"id":"100000000000040001"
},
"response_status":{
"status_code":2000,
"status":"success"
}
}
Delinking A Ci
This operation helps you to delink a CI from an existing entity like Asset, Department, Site, User, etc.
Url
<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}
$ curl <service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}\
-X PUT\
-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_computer":{
"linked_entity":null,
"linked_instance": null
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/cmdb/{ci_type_api_name}/{ci_id}";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"ci_computer":{
"linked_entity":null,
"linked_instance": null
}
};
params = {"input_data": input_data};
response = invokeurl
[
url: url
type: PUT
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}"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
"ci_computer":{
"linked_entity":null,
"linked_instance": null
}
}
'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method put -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}"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"ci_computer":{
"linked_entity":null,
"linked_instance": null
}
}'''
data = urlencode({"input_data":input_data}).encode()
httprequest = Request(url, headers=headers,data=data, method="PUT")
try:
with urlopen(httprequest) as response:
print(response.read().decode())
except HTTPError as e:
print(e.read().decode())
{
"ci_computer":{
"linked_instance":null,
"created_time":{
"display_value":"Aug 13, 2021 02:58 PM",
"value":"1628846921920"
},
"attachments":[
],
"ci_attributes":{
"txt_installation_path":null,
"ref_owned_by":null,
"txt_location":null,
"txt_version":null,
"ref_managed_by":null,
"ref_business_impact":null,
"date_installed_on":null,
"txt_license_key":null
},
"description":null,
"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": ""
},
"data_source":[
],
"last_updated_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": ""
},
"ci_type":{
"api_plural_name":"ci_computer",
"name":"ci_computer",
"display_name_plural":"Computer",
"id":"100000000000029962",
"display_name":"Computer",
"icon_name":"computer"
},
"linked_entity":null,
"last_updated_time":{
"display_value":"Aug 13, 2021 05:28 PM",
"value":"1628855899979"
},
"name":"Application",
"id":"100000000000040001"
},
"response_status":{
"status_code":2000,
"status":"success"
}
}