<service domain|custom domain>/app/<portal>/api/v3/contracts
合同
ManageEngine ServiceDesk Plus Cloud 中的合同管理使您能够制定、控制和管理与外部方的合同。合同管理可以与事件管理和资产管理配合使用。您可以为资产和软件创建合同,或创建独立合同。
属性
is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false
更多属性 展开全部
expiry_notification (JSONObject)
包含到期通知的详细信息
show attribute
添加合同
使用此操作创建新合同。
必填字段:name、vendor、active_from、owner、is_definite
Url
属性
is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false
更多属性 展开全部
expiry_notification (JSONObject)
包含到期通知的详细信息
show attribute
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts\
-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='{
"contract": {
"template": {
"id": "2000000030626"
},
"cost": {
"secondary_currency": {
"value": "2322"
},
"value": "2322.00"
},
"owner": {
"id": "2000000036237"
},
"assets": [
{
"asset": {
"id": "2000000036443"
}
},
{
"asset": {
"id": "2000000036389"
}
}
],
"attachments": [],
"software_licenses": [],
"is_definite": true,
"is_notification_required": true,
"is_req_creation_required": false,
"is_auto_renew": true,
"name": "Contract Check",
"vendor": {
"id": "2000000036323"
},
"type": {
"id": "2000000003022"
},
"active_from": {
"value": 1680287400000
},
"parent_contract": null,
"sites": [
{
"id": "2000000006130"
}
],
"exchange_rate": "1",
"comments": "Description",
"support": "Support Details",
"expiry_notification": {
"notify_technicians": [
{
"id": "2000000036237"
}
],
"email_ids_to_notify": null,
"notify_days": [
{
"notify_before": "2"
}
]
},
"request_creation_days": "0",
"active_till": {
"value": 1685557799999
},
"is_draft": false,
"auto_renew": [
{
"auto_renew_extension": {
"prolongation": 2,
"period": "months"
},
"auto_renew_notify": [
{
"id": "2000000036237"
}
]
}
]
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"contract": {
"template": {
"id": "2000000030626"
},
"cost": {
"secondary_currency": {
"value": "2322"
},
"value": "2322.00"
},
"owner": {
"id": "2000000036237"
},
"assets": [
{
"asset": {
"id": "2000000036443"
}
},
{
"asset": {
"id": "2000000036389"
}
}
],
"attachments": [],
"software_licenses": [],
"is_definite": true,
"is_notification_required": true,
"is_req_creation_required": false,
"is_auto_renew": true,
"name": "Contract Check",
"vendor": {
"id": "2000000036323"
},
"type": {
"id": "2000000003022"
},
"active_from": {
"value": 1680287400000
},
"parent_contract": null,
"sites": [
{
"id": "2000000006130"
}
],
"exchange_rate": "1",
"comments": "Description",
"support": "Support Details",
"expiry_notification": {
"notify_technicians": [
{
"id": "2000000036237"
}
],
"email_ids_to_notify": null,
"notify_days": [
{
"notify_before": "2"
}
]
},
"request_creation_days": "0",
"active_till": {
"value": 1685557799999
},
"is_draft": false,
"auto_renew": [
{
"auto_renew_extension": {
"prolongation": 2,
"period": "months"
},
"auto_renew_notify": [
{
"id": "2000000036237"
}
]
}
]
}
};
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/contracts"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
"contract": {
"template": {
"id": "2000000030626"
},
"cost": {
"secondary_currency": {
"value": "2322"
},
"value": "2322.00"
},
"owner": {
"id": "2000000036237"
},
"assets": [
{
"asset": {
"id": "2000000036443"
}
},
{
"asset": {
"id": "2000000036389"
}
}
],
"attachments": [],
"software_licenses": [],
"is_definite": true,
"is_notification_required": true,
"is_req_creation_required": false,
"is_auto_renew": true,
"name": "Contract Check",
"vendor": {
"id": "2000000036323"
},
"type": {
"id": "2000000003022"
},
"active_from": {
"value": 1680287400000
},
"parent_contract": null,
"sites": [
{
"id": "2000000006130"
}
],
"exchange_rate": "1",
"comments": "Description",
"support": "Support Details",
"expiry_notification": {
"notify_technicians": [
{
"id": "2000000036237"
}
],
"email_ids_to_notify": null,
"notify_days": [
{
"notify_before": "2"
}
]
},
"request_creation_days": "0",
"active_till": {
"value": 1685557799999
},
"is_draft": false,
"auto_renew": [
{
"auto_renew_extension": {
"prolongation": 2,
"period": "months"
},
"auto_renew_notify": [
{
"id": "2000000036237"
}
]
}
]
}
}
'@
$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/contracts"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"contract": {
"template": {
"id": "2000000030626"
},
"cost": {
"secondary_currency": {
"value": "2322"
},
"value": "2322.00"
},
"owner": {
"id": "2000000036237"
},
"assets": [
{
"asset": {
"id": "2000000036443"
}
},
{
"asset": {
"id": "2000000036389"
}
}
],
"attachments": [],
"software_licenses": [],
"is_definite": true,
"is_notification_required": true,
"is_req_creation_required": false,
"is_auto_renew": true,
"name": "Contract Check",
"vendor": {
"id": "2000000036323"
},
"type": {
"id": "2000000003022"
},
"active_from": {
"value": 1680287400000
},
"parent_contract": null,
"sites": [
{
"id": "2000000006130"
}
],
"exchange_rate": "1",
"comments": "Description",
"support": "Support Details",
"expiry_notification": {
"notify_technicians": [
{
"id": "2000000036237"
}
],
"email_ids_to_notify": null,
"notify_days": [
{
"notify_before": "2"
}
]
},
"request_creation_days": "0",
"active_till": {
"value": 1685557799999
},
"is_draft": false,
"auto_renew": [
{
"auto_renew_extension": {
"prolongation": 2,
"period": "months"
},
"auto_renew_notify": [
{
"id": "2000000036237"
}
]
}
]
}
}'''
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())
{
"response_status": {
"status_code": 2000,
"status": "success"
},
"contract": {
"is_auto_renew": true,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "2000000030626"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-4",
"value": "4"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "2000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Apr 1, 2023",
"value": "1680287400000"
},
"type": {
"color": "#ff6666",
"name": "Lease",
"id": "2000000003022"
},
"is_req_creation_required": false,
"contract_renewed_from": null,
"assets": [
{
"asset": {
"site": {
"deleted": false,
"name": "Base Site",
"id": "2000000006130",
"is_default": true
},
"name": "AP - PO# 1[10]",
"id": "2000000036443"
}
},
{
"asset": {
"site": {
"deleted": false,
"name": "Base Site",
"id": "2000000006130",
"is_default": true
},
"name": "AP - PO# 1[1]",
"id": "2000000036389"
}
}
],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [
{
"notification": null,
"notify_before": "2",
"id": "2000000037077"
}
],
"notify_technicians": [
{
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": "xxxxxxxxxxx",
"last_name": "T",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "2000000006130"
},
"phone": "",
"employee_id": null,
"name": "Test",
"id": "2000000036237",
"photo_url": "test-photo-url",
"is_vip_user": false,
"department": null,
"first_name": "Test",
"job_title": null
}
]
},
"configuration_items": [],
"is_notification_required": true,
"vendor": {
"name": "AA",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "2000000004129"
},
"id": "2000000036323"
},
"is_draft": false,
"active_till": {
"display_value": "May 31, 2023",
"value": "1685557799999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "2000000004129"
},
"parent_contract": null,
"id": "2000000037061",
"is_notification_disabled": false,
"is_renewed": false,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": "xxxxxxxxxx",
"last_name": "T",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "2000000006130"
},
"phone": "",
"employee_id": null,
"name": "Test",
"id": "2000000036237",
"photo_url": "test-photo-url",
"is_vip_user": false,
"department": null,
"first_name": "Test",
"job_title": null
},
"is_definite": true,
"comments": "Description",
"cost": {
"display_value": "2322.00",
"currency_symbol": "$",
"value": 2322,
"secondary_currency": {
"display_value": 2322,
"currency_symbol": "$",
"value": 2322
}
},
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": null,
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": "xxxxxxxxxxx",
"last_name": "T",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "2000000006130",
"is_default": true
},
"phone": "",
"employee_id": null,
"name": "Test",
"id": "2000000036237",
"photo_url": "test-photo-url",
"is_vip_user": false,
"department": null,
"first_name": "Test",
"job_title": null
},
"people": [],
"software_licenses": [],
"auto_renew": [
{
"auto_renew_extension": {
"period": "months",
"prolongation": "2"
},
"id": "2000000037083",
"auto_renew_notify": [
{
"email_id": "test1@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": "xxxxxxxxxx",
"last_name": "T",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "2000000006130"
},
"phone": "",
"employee_id": null,
"name": "Test",
"id": "2000000036237",
"photo_url": "test-photo-url",
"is_vip_user": false,
"department": null,
"first_name": "Test",
"job_title": null
}
]
}
],
"name": "Contract Check",
"created_date": {
"display_value": "Apr 17, 2023",
"value": "1681737551518"
},
"support": "Support Details",
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Active",
"id": "2000000002571"
}
}
}
编辑合同
使用此操作编辑合同。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}
属性
is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false
更多属性 展开全部
expiry_notification (JSONObject)
包含到期通知的详细信息
show attribute
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_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='{
"contract": {
"cost": {
"value": "5.00"
},
"active_from": {
"value": 1678213800000
},
"active_till": null,
"name": "editcontract",
"is_definite": false
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"contract": {
"cost": {
"value": "5.00"
},
"active_from": {
"value": 1678213800000
},
"active_till": null,
"name": "editcontract",
"is_definite": false
}
};
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/contracts/{contract_id}"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"contract": {
"cost": {
"value": "5.00"
},
"active_from": {
"value": 1678213800000
},
"active_till": null,
"name": "editcontract",
"is_definite": false
}
}
'@
$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/contracts/{contract_id}"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"contract": {
"cost": {
"value": "5.00"
},
"active_from": {
"value": 1678213800000
},
"active_till": null,
"name": "editcontract",
"is_definite": false
}
}'''
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())
{
"response_status": {
"status_code": 2000,
"status": "success"
},
"contract": {
"is_auto_renew": false,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-12",
"value": "12"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Mar 8, 2023",
"value": "1678213800000"
},
"type": null,
"is_req_creation_required": false,
"contract_renewed_from": null,
"assets": [],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"active_till": null,
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"parent_contract": null,
"id": "100000000000037183",
"is_notification_disabled": false,
"is_renewed": false,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"is_definite": false,
"comments": null,
"cost": {
"display_value": "5.00",
"currency_symbol": "$",
"value": 5,
"secondary_currency": {
"display_value": 5,
"currency_symbol": "$",
"value": 5
}
},
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": null,
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"people": [],
"software_licenses": [],
"auto_renew": [],
"name": "editcontract",
"created_date": {
"display_value": "Mar 31, 2023",
"value": "1680241541555"
},
"support": null,
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Active",
"id": "100000000000002571"
}
}
}
获取合同
使用此操作获取单个合同。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}
属性
is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false
更多属性 展开全部
expiry_notification (JSONObject)
包含到期通知的详细信息
show attribute
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}\
-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/contracts/{contract_id}";
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/contracts/{contract_id}"
$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/contracts/{contract_id}"
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"
},
"contract": {
"is_auto_renew": false,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-12",
"value": "12"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Mar 8, 2023",
"value": "1678213800000"
},
"type": null,
"is_req_creation_required": false,
"contract_renewed_from": null,
"assets": [
{
"asset": {
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"name": "asfc",
"id": "100000000000037221"
}
}
],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"active_till": null,
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"parent_contract": null,
"id": "100000000000037183",
"is_notification_disabled": false,
"is_renewed": false,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"is_definite": false,
"comments": null,
"cost": {
"display_value": "5.00",
"currency_symbol": "$",
"value": 5,
"secondary_currency": {
"display_value": 5,
"currency_symbol": "$",
"value": 5
}
},
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": null,
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"people": [],
"software_licenses": [
{
"software_license": {
"name": "dfgh-100000000000037101",
"id": "100000000000037101"
}
}
],
"auto_renew": [],
"name": "editcontract",
"created_date": {
"display_value": "Mar 31, 2023",
"value": "1680241541555"
},
"support": null,
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Active",
"id": "100000000000002571"
}
}
}
获取合同列表
使用此操作获取所有合同列表。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts
属性
更多属性 展开全部
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/contracts\
-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"\
--data-urlencode input_data='{}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {};
params = {"input_data":input_data};
response = invokeurl
[
url: url
type: GET
parameters:params
headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/contracts"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'{}'@
$data = @{ 'input_data' = $input_data}
$response = Invoke-RestMethod -Uri $url -Method get -Body $data -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/contracts"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{}'''
url += "?" + urlencode({"input_data":input_data})
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": true,
"sort_field": "name",
"row_count": 10
},
"contracts": [
{
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"is_definite": true,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"request_creation_days": "0",
"display_id": {
"display_value": "CON-8",
"value": "8"
},
"sites": [
{
"name": "Base Site",
"id": "100000000000006130"
}
],
"active_from": {
"display_value": "Mar 15, 2023",
"value": "1678818600000"
},
"type": null,
"is_req_creation_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": true,
"name": "contract1",
"active_till": {
"display_value": "Apr 18, 2023",
"value": "1681842599999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"is_frequent": true,
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000037043",
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Draft",
"id": "100000000000002577"
}
},
{
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"is_definite": true,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"request_creation_days": "0",
"display_id": {
"display_value": "CON-3",
"value": "3"
},
"sites": [
{
"name": "Base Site",
"id": "100000000000006130"
}
],
"active_from": {
"display_value": "Mar 6, 2023",
"value": "1678041000000"
},
"type": null,
"is_req_creation_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"name": "DCS",
"active_till": {
"display_value": "Mar 9, 2023",
"value": "1678386599999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"is_frequent": true,
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036351",
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Expired",
"id": "100000000000002573"
}
},
{
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"is_definite": true,
"cost": {
"display_value": "2222.00",
"currency_symbol": "$",
"value": 2222,
"secondary_currency": {
"display_value": 2222,
"currency_symbol": "$",
"value": 2222
}
},
"request_creation_days": "0",
"display_id": {
"display_value": "CON-2",
"value": "2"
},
"sites": [
{
"name": "Base Site",
"id": "100000000000006130"
}
],
"active_from": {
"display_value": "Mar 15, 2023",
"value": "1678818600000"
},
"type": {
"color": "#aaff66",
"name": "Maintenance",
"id": "100000000000003019"
},
"is_req_creation_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": true,
"name": "contract1",
"active_till": {
"display_value": "Mar 15, 2023",
"value": "1678904999999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"is_frequent": true,
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036337",
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Draft",
"id": "100000000000002577"
}
},
{
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"is_definite": true,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"request_creation_days": "0",
"display_id": {
"display_value": "CON-4",
"value": "4"
},
"sites": [
{
"name": "Base Site",
"id": "100000000000006130"
}
],
"active_from": {
"display_value": "Mar 6, 2023",
"value": "1678041000000"
},
"type": null,
"is_req_creation_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"name": "tract2",
"active_till": {
"display_value": "Apr 10, 2023",
"value": "1681151399999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"is_frequent": true,
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036375",
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Canceled",
"id": "100000000000002579"
}
}
]
}
删除合同
使用此操作删除合同。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}\
-X DELETE\
-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/contracts/{contract_id}";
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: DELETE
headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}"
$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 delete -Headers $headers
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.request import urlopen,Request
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}"
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,method="DELETE")
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"
}
}
续订合同
使用此操作续签现有合同。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_renew_contract
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_renew_contract\
-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='{
"contract": {
"is_auto_renew": false,
"template": {
"id": "100000000000030618"
},
"request_creation_days": "0",
"sites": [
{
"id": "100000000000006130"
}
],
"type": null,
"is_req_creation_required": false,
"expiry_notification": {
"email_ids_to_notify": "",
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"id": "100000000000036303"
},
"is_draft": false,
"owner": {
"id": "100000000000036225"
},
"is_definite": true,
"comments": null,
"cost": {
"secondary_currency": {
"value": "0.00"
},
"value": "0.00"
},
"exchange_rate": null,
"services": [],
"people": [],
"name": "contract2 Renewed Renewed",
"support": null,
"attachments": [],
"active_from": {
"value": 1682620200000
},
"parent_contract": null,
"active_till": {
"value": 1682792999999
},
"auto_renew": []
},
"disable_notification": false
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_renew_contract";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"contract": {
"is_auto_renew": false,
"template": {
"id": "100000000000030618"
},
"request_creation_days": "0",
"sites": [
{
"id": "100000000000006130"
}
],
"type": null,
"is_req_creation_required": false,
"expiry_notification": {
"email_ids_to_notify": "",
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"id": "100000000000036303"
},
"is_draft": false,
"owner": {
"id": "100000000000036225"
},
"is_definite": true,
"comments": null,
"cost": {
"secondary_currency": {
"value": "0.00"
},
"value": "0.00"
},
"exchange_rate": null,
"services": [],
"people": [],
"name": "contract2 Renewed Renewed",
"support": null,
"attachments": [],
"active_from": {
"value": 1682620200000
},
"parent_contract": null,
"active_till": {
"value": 1682792999999
},
"auto_renew": []
},
"disable_notification": false
};
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/contracts/{contract_id}/_renew_contract"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"contract": {
"is_auto_renew": false,
"template": {
"id": "100000000000030618"
},
"request_creation_days": "0",
"sites": [
{
"id": "100000000000006130"
}
],
"type": null,
"is_req_creation_required": false,
"expiry_notification": {
"email_ids_to_notify": "",
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"id": "100000000000036303"
},
"is_draft": false,
"owner": {
"id": "100000000000036225"
},
"is_definite": true,
"comments": null,
"cost": {
"secondary_currency": {
"value": "0.00"
},
"value": "0.00"
},
"exchange_rate": null,
"services": [],
"people": [],
"name": "contract2 Renewed Renewed",
"support": null,
"attachments": [],
"active_from": {
"value": 1682620200000
},
"parent_contract": null,
"active_till": {
"value": 1682792999999
},
"auto_renew": []
},
"disable_notification": false
}
'@
$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/contracts/{contract_id}/_renew_contract"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"contract": {
"is_auto_renew": false,
"template": {
"id": "100000000000030618"
},
"request_creation_days": "0",
"sites": [
{
"id": "100000000000006130"
}
],
"type": null,
"is_req_creation_required": false,
"expiry_notification": {
"email_ids_to_notify": "",
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"id": "100000000000036303"
},
"is_draft": false,
"owner": {
"id": "100000000000036225"
},
"is_definite": true,
"comments": null,
"cost": {
"secondary_currency": {
"value": "0.00"
},
"value": "0.00"
},
"exchange_rate": null,
"services": [],
"people": [],
"name": "contract2 Renewed Renewed",
"support": null,
"attachments": [],
"active_from": {
"value": 1682620200000
},
"parent_contract": null,
"active_till": {
"value": 1682792999999
},
"auto_renew": []
},
"disable_notification": false
}'''
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())
{
"response_status": {
"status_code": 2000,
"status": "success"
},
"contract": {
"is_auto_renew": false,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-7",
"value": "7"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Apr 28, 2023",
"value": "1682620200000"
},
"type": null,
"is_req_creation_required": false,
"contract_renewed_from": {
"is_auto_renew": false,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-5",
"value": "5"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Apr 18, 2023",
"value": "1681756200000"
},
"type": null,
"is_req_creation_required": false,
"contract_renewed_from": {
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0
},
"display_id": {
"display_value": "CON-4",
"value": "4"
},
"vendor": {
"id": "100000000000036303"
},
"name": "contract2",
"active_till": {
"display_value": "Apr 10, 2023",
"value": "1681151399999"
},
"id": "100000000000036375",
"active_from": {
"display_value": "Mar 6, 2023",
"value": "1678041000000"
},
"status": {
"id": "100000000000002579"
}
},
"assets": [],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"active_till": {
"display_value": "Apr 28, 2023",
"value": "1682706599999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"parent_contract": null,
"id": "100000000000036383",
"is_notification_disabled": false,
"is_renewed": true,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"is_definite": true,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"comments": null,
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": "100000000000036375",
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"people": [],
"software_licenses": [],
"auto_renew": [],
"name": "contract2 Renewed",
"created_date": {
"display_value": "Mar 30, 2023",
"value": "1680176711401"
},
"support": null,
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Yet to be Active",
"id": "100000000000002575"
}
},
"assets": [],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"active_till": {
"display_value": "Apr 29, 2023",
"value": "1682792999999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"parent_contract": null,
"id": "100000000000037029",
"is_notification_disabled": false,
"is_renewed": false,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"is_definite": true,
"comments": null,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": "100000000000036375",
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"people": [],
"software_licenses": [],
"auto_renew": [],
"name": "contract2 Renewed Renewed",
"created_date": {
"display_value": "Mar 30, 2023",
"value": "1680182530708"
},
"support": null,
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Yet to be Active",
"id": "100000000000002575"
}
}
}
取消合同
使用此操作取消合同
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_cancel
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_cancel \
-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='{
"notification": {
"is_notify": true,
"to": [
"test@zmail.com"
],
"cancel_comments": "CANCEL",
"dissociate_child": true
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_cancel ";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"notification": {
"is_notify": true,
"to": [
"test@zmail.com"
],
"cancel_comments": "CANCEL",
"dissociate_child": true
}
};
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/contracts/{contract_id}/_cancel "
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
"notification": {
"is_notify": true,
"to": [
"test@zmail.com"
],
"cancel_comments": "CANCEL",
"dissociate_child": true
}
}
'@
$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/contracts/{contract_id}/_cancel "
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"notification": {
"is_notify": true,
"to": [
"test@zmail.com"
],
"cancel_comments": "CANCEL",
"dissociate_child": true
}
}'''
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())
{
"response_status": {
"status_code": 2000,
"messages": [
{
"status_code": 2000,
"type": "success",
"message": "Contract canceled."
}
],
"status": "success"
}
}
发送电子邮件给合同所有者
使用此操作向合同拥有者发送邮件。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_email_owner
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_email_owner\
-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/contracts/{contract_id}/_email_owner";
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/contracts/{contract_id}/_email_owner"
$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/contracts/{contract_id}/_email_owner"
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())
{
"notification": {
"subject": "Assigned contract with ID: CON-7",
"description": "Hi test,<br /><br />The contract ID: CON-7 has been assigned to you. The contract is active from Feb 1, 2019 to Sep 4, 2021.<br /><br />Contract Details<br />Contract Name : Contract3<br />Type : <br />Cost : 0<br />Vendor : Canon <br /><br />For more information, visit the following link: <br /><a href='https://test.test1/app/itdesk/ui/contracts/100000000000033283/details?selectTab=contractinfo'>https://test.test1/app/itdesk/ui/contracts/100000000000033283/details?selectTab=contractinfo</a><br /><br />Regards,<br />Admin Team<br /><br />This is an automated message. Please do not reply to this email.",
"to": [
"test@zmail.com"
]
},
"response_status": {
"status_code": 2000,
"status": "success"
}
}
从垃圾箱恢复合同
使用此操作从回收站恢复合同。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_restore_from_trash
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_restore_from_trash\
-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='{}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_restore_from_trash";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {};
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/contracts/{contract_id}/_restore_from_trash"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{}
'@
$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/contracts/{contract_id}/_restore_from_trash"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{}'''
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())
{
"response_status": [
{
"status_code": 2000,
"id": "100000000000037365",
"status": "success"
}
],
"contracts": {
"is_auto_renew": false,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-13",
"value": "13"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Mar 15, 2023",
"value": "1678818600000"
},
"type": null,
"is_req_creation_required": false,
"contract_renewed_from": null,
"assets": [],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"active_till": {
"display_value": "Apr 10, 2023",
"value": "1681151399999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"parent_contract": null,
"id": "100000000000037365",
"is_notification_disabled": false,
"is_renewed": false,
"vendor_currency_id": null,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"contact_info_id": "100000000000036223",
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"is_definite": true,
"comments": null,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"escalate_to_id": null,
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": null,
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"contact_info_id": "100000000000036223",
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"people": [],
"software_licenses": [],
"is_escalated": true,
"auto_renew": [],
"name": "movetotrash",
"created_date": {
"display_value": "Mar 31, 2023",
"value": "1680247193980"
},
"support": null,
"deleted_time": null,
"notes_present": false,
"status": {
"name": "Active",
"id": "100000000000002571"
}
}
}
解除软件许可证与合同的关联
使用此操作解除软件许可与合同的关联。必填字段:软件许可ID 注:Content-Type须为x-www-form-urlencoded格式输入data。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses\
-X DELETE\
-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/contracts/{contract_id}/software_licenses";
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: DELETE
headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses"
$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 delete -Headers $headers
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.request import urlopen,Request
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses"
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,method="DELETE")
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"
}
}
移动合同到垃圾箱
用于将合同移至回收站。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_move_to_trash
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_move_to_trash\
-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='{}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_move_to_trash";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {};
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/contracts/{contract_id}/_move_to_trash"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{}
'@
$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/contracts/{contract_id}/_move_to_trash"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{}'''
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())
{
"response_status": {
"status_code": 2000,
"status": "success"
},
"contract": {
"is_auto_renew": false,
"template": {
"inactive": false,
"name": "General Contract Template",
"id": "100000000000030618"
},
"attachments": [],
"request_creation_days": "0",
"display_id": {
"display_value": "CON-13",
"value": "13"
},
"sites": [
{
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
}
],
"active_from": {
"display_value": "Mar 15, 2023",
"value": "1678818600000"
},
"type": null,
"is_req_creation_required": false,
"contract_renewed_from": null,
"assets": [],
"expiry_notification": {
"email_ids_to_notify": [],
"notify_days": [],
"notify_technicians": []
},
"configuration_items": [],
"is_notification_required": false,
"vendor": {
"name": "vendor1",
"description": "No Description",
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"id": "100000000000036303"
},
"is_draft": false,
"active_till": {
"display_value": "Apr 10, 2023",
"value": "1681151399999"
},
"currency": {
"symbol": "$",
"code": "USD",
"exchange_rate": "1",
"name": "US Dollar",
"id": "100000000000004129"
},
"parent_contract": null,
"id": "100000000000037365",
"is_notification_disabled": false,
"is_renewed": false,
"vendor_currency_id": null,
"expiry_request": null,
"owner": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"contact_info_id": "100000000000036223",
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"id": "100000000000006130"
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"is_definite": true,
"comments": null,
"cost": {
"display_value": "0.00",
"currency_symbol": "$",
"value": 0,
"secondary_currency": {
"display_value": 0,
"currency_symbol": "$",
"value": 0
}
},
"escalate_to_id": null,
"contract_usage": [],
"exchange_rate": null,
"contract_renewal_origin": null,
"services": [],
"created_by": {
"email_id": "test@zmail.com",
"is_technician": true,
"sms_mail": null,
"contact_info_id": "100000000000036223",
"mobile": null,
"last_name": "test",
"user_scope": "internal_user",
"sms_mail_id": null,
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006130",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "test",
"id": "100000000000036225",
"photo_url": "test-photo_url",
"is_vip_user": false,
"department": null,
"first_name": "test",
"job_title": null
},
"people": [],
"software_licenses": [],
"is_escalated": true,
"auto_renew": [],
"name": "movetotrash",
"created_date": {
"display_value": "Mar 31, 2023",
"value": "1680247193980"
},
"support": null,
"deleted_time": {
"display_value": "Mar 31, 2023 12:50 PM",
"value": "1680247203538"
},
"notes_present": false,
"status": {
"name": "Active",
"id": "100000000000002571"
}
}
}
将合同与另一合同关联
使用此操作将子合同与父合同关联。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts\
-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='{
"contract_relationship": {
"child_contract": {
"id": "100000000000033287"
}
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"contract_relationship": {
"child_contract": {
"id": "100000000000033287"
}
}
};
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/contracts/{Parent contract_id}/child_contracts"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"contract_relationship": {
"child_contract": {
"id": "100000000000033287"
}
}
}
'@
$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/contracts/{Parent contract_id}/child_contracts"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"contract_relationship": {
"child_contract": {
"id": "100000000000033287"
}
}
}'''
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())
{
"response_status": {
"status_code": 2000,
"status": "success"
},
"contract_relationship": {
"child_contract": {
"name": "Child 1",
"id": "100000000000033287"
},
"parent_contract": {
"id": 100000000000033283
}
}
}
关联资产与合同
用于将资产与合同关联。必填字段:资产名称或资产ID
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets\
-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='{
"assets":[ {
"asset": {
"name": "access point_1"
}
}]
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"assets":[ {
"asset": {
"name": "access point_1"
}
}]
};
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/contracts/{contract_id}/assets"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"assets":[ {
"asset": {
"name": "access point_1"
}
}]
}
'@
$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/contracts/{contract_id}/assets"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"assets":[ {
"asset": {
"name": "access point_1"
}
}]
}'''
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())
{
"response_status": {
"status_code": 2000,
"status": "success"
},
"assets": {
"contract": {
"id": 100000000000033283
},
"asset": {
"name": "access point_1",
"id": "100000000000033317"
}
}
}
解除资产与合同的关联
用于将资产与合同解除关联。必填字段:资产名称或资产ID
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets\
-X DELETE\
-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/contracts/{contract_id}/assets";
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: DELETE
headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets"
$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 delete -Headers $headers
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.request import urlopen,Request
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/assets"
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,method="DELETE")
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"
}
}
关联软件许可证与合同
使用此操作将软件许可与合同关联。必填字段:软件许可ID
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses\
-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='{
"software_licenses": [{
"software_license": {
"id": "100000000000040109"
}
}]
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/software_licenses";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"software_licenses": [{
"software_license": {
"id": "100000000000040109"
}
}]
};
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/contracts/{contract_id}/software_licenses"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"software_licenses": [{
"software_license": {
"id": "100000000000040109"
}
}]
}
'@
$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/contracts/{contract_id}/software_licenses"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"software_licenses": [{
"software_license": {
"id": "100000000000040109"
}
}]
}'''
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())
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"software_licenses": {
"contract": {
"id": 100000000000036061
},
"software_license": {
"id": "100000000000040109"
}
}
}
解除合同与另一合同的关联
用于将子合同与父合同解除关联。必填字段:子合同名称或子合同ID
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts\
-X DELETE\
-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/contracts/{Parent contract_id}/child_contracts";
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: DELETE
headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts"
$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 delete -Headers $headers
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.request import urlopen,Request
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{Parent contract_id}/child_contracts"
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,method="DELETE")
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"
}
}
发送电子邮件给合同供应商
用于向合同供应商发送电子邮件。
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_email_vendor
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_email_vendor\
-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/contracts/{contract_id}/_email_vendor";
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/contracts/{contract_id}/_email_vendor"
$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/contracts/{contract_id}/_email_vendor"
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())
{
"notification": {
"subject": "Initiated contract with ID: CON-7",
"description": "The contract ID: CON-7 has been initiated with you. The contract is active from Feb 1, 2019 to Sep 4, 2021.<br /><br />Contract Details<br />Contract Name : Contract3<br />Type : <br />Cost : 0<br />Vendor : Canon<br />Owner : test<br /><br />For more information, visit the following link: <br /><a href='https://test.test1/app/itdesk/ui/contracts/100000000000033283/details?selectTab=contractinfo'>https://test.test1/app/itdesk/ui/contracts/100000000000033283/details?selectTab=contractinfo</a><br /><br />Regards,<br />Admin Team<br /><br />This is an automated message. Please do not reply to this email.",
"to": []
},
"response_status": {
"status_code": 2000,
"status": "success"
}
}
上传合同附件
用于向合同添加附件。
必填字段:- 文件名
Url
<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_uploads
属性
addtoattachment (布尔)
表示是否将文件作为附件添加到关联实体。
文件 (多个文件)
这里包含文件的详细信息。
show attribute
$ curl <service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_uploads\
-X POST\
-H "Accept: application/vnd.manageengine.sdp.v3+json"\
-H "Authorization: Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"\
-H "Content-Type: multipart/form-data"\
-F "filename=@local_file_path" -F "addtoattachment=true"\
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_uploads";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "multipart/form-data",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
file_list = List();
param1 = {"paramName":"filename", "content":"local_file_path"};
file_list.add(param1);
response = invokeurl
[
url: url
type: POST
headers: headers
files: file_list
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_uploads"
$filePath = "local_file_path"
$addtoattachment = "true"
$boundary = [System.Guid]::NewGuid().ToString()
$headers = @{
"Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "multipart/form-data; boundary=`"$boundary`""
}
$content = [System.Text.Encoding]::GetEncoding('iso-8859-1').GetString([System.IO.File]::ReadAllBytes($filePath))
$body = (
"--$boundary",
"Content-Disposition: form-data; name=`"addtoattachment`"`r`n",
"$addtoattachment",
"--$boundary",
"Content-Disposition: form-data; name=`"filename`"; filename=`"$(Split-Path $filePath -Leaf)`"",
"Content-Type: $([System.Web.MimeMapping]::GetMimeMapping($filePath))`r`n",
$content,
"--$boundary--`r`n"
) -join "`r`n"
$response = Invoke-RestMethod -Uri $url -Method post -Headers $headers -Body $body
$response
#Python version - 3.10
from urllib.error import HTTPError
from urllib.request import Request,urlopen
import mimetypes
import ntpath
import uuid
url = "<service domain|custom domain>/app/<portal>/api/v3/contracts/{contract_id}/_uploads"
file_path = "local_file_path"
add_to_attachments = "true"
boundary = uuid.uuid4()
headers = {
"Content-Type": f"multipart/form-data; boundary={boundary}",
"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
}
with open(file_path, "rb") as f:
content = f.read()
body = (
bytes(f'--{boundary}\r\nContent-Disposition: form-data; name="addtoattachment"\r\n\r\n{add_to_attachments}\r\n', "utf-8")
+ bytes(f'--{boundary}\r\nContent-Disposition: form-data; name="filename"; filename="{ntpath.basename(file_path)}"\r\nContent-Type: {mimetypes.guess_type(file_path)[0] or "application/octet-stream"}\r\n\r\n', "utf-8")
+ content
+ bytes(f"\r\n--{boundary}--", "utf-8")
)
httprequest = Request(url, data=body, headers=headers)
try:
with urlopen(httprequest) as response:
print(response.read().decode("utf-8"))
except HTTPError as e:
print(e.read().decode())
{
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"files": [
{
"content_type": "image/jpeg",
"size": "241480",
"file_id": "2001",
"name": "00f13d1f7cd9ca47c8eb4b6fdb89b0ee.jpg",
"content_url": "/contracts/_uploads/2001"
}
]
}