跳至内容

合同

ManageEngine ServiceDesk Plus Cloud 中的合同管理使您能够制定、控制和管理与外部方的合同。合同管理可以与事件管理和资产管理配合使用。您可以为资产和软件创建合同,或创建独立合同。

属性

id (long)
用于识别合同的唯一标识符

id (long)
用于识别合同的唯一标识符

示例

234759602834500

name (string)
用于识别合同的唯一名称 

name (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

vendor (vendor)
表示合同的供应商

vendor (vendor)
表示合同的供应商

示例

{
  "vendor": {
    "id": "100000000000033225"
  }
}

active_from (date)
表示合同的开始日期 

active_from (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

owner (用户)
表示合同拥有者名称 

owner (用户)
包含合同拥有者的详细信息

示例

{
  "owner": {
    "name": "test-contract_owner",
    "id": "234567890123456"
  }
}

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同。

更多属性 展开全部

comments (string)

合同描述

comments (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

support (string)

指定合同所包含的支持内容。例如:涉及的资源、提供的物资、任何条款和条件等。

support (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

active_till (date)

表示合同结束日期

active_till (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

exchange_rate (双精度数值)

指定合同成本的货币兑换率

exchange_rate (双精度数值)
指定合同成本的货币兑换率

示例

23.08

is_notification_required (布尔值)

布尔值表示是否需要此合同通知

is_notification_required (布尔值)
布尔值,可取两个可能值,true 和 false。

is_req_creation_required (布尔值)

表示合同到期时是否需要创建请求

is_req_creation_required (布尔值)
布尔值,可取两个可能值,true 和 false。

request_creation_days (long)

包含需要创建请求的提前天数

request_creation_days (long)
视为较大值的数字

示例

234759602834500

is_draft (布尔值)

布尔值表示此合同是否为草稿

is_draft (布尔值)
 布尔值表示此合同是否为草稿

is_auto_renew (布尔值)

布尔值表示此合同是否启用自动续约

is_auto_renew (布尔值)
 布尔值表示此合同是否启用自动续约

type (contract_type)

表示合同类型。例如:维护、租赁、支持、保修等。

type (contract_type)
包含合同类型的详细信息

示例

{
  "type": {
    "color": "#ff6666",
    "name": "Lease",
    "id": "100000000000002823"
  }
}

assets (contract_asset_association)

表示与合同关联的资产数组

assets (contract_asset_association)
包含关联资产的详细信息

示例

{
  "contract_asset_association": {
    "asset": {
      "name": "access point_1"
    }
  }
}

software_licenses (contract_swlicense_association)

表示与合同关联的软件许可数组

software_licenses (contract_swlicense_association)
表示与合同关联的软件许可数组

示例

{
  "contract_swlicense_association": {
    "software_license": {
      "id": "100000000000036043"
    }
  }
}

parent_contract (contract)

表示该合同作为子合同关联的合同

parent_contract (contract)
该合同作为子合同关联的合同详情

示例

{
  "parent_contract": {
    "id": "100000000000049155"
  }
}

child_contracts (contract_relationship)

包含该合同作为父合同关联的合同列表

child_contracts (contract_relationship)
包含与合同关联的子合同列表

示例

{
  "contract_relationship": {
    "child_contract": {
      "name": "Child 1"
    }
  }
}

attachments (attachment)

附加到合同的文件。最多可附加50个文件

attachments (attachment)
附加到合同的文件。

示例

{
  "attachments": [
    {
      "content_type": "application/x-unknown-mime-type",
      "size": "36171",
      "file_id": "4001",
      "name": "test_file.txt"
    }
  ]
}

udf_fields (udf_fields)

保存与合同关联的用户定义字段值

udf_fields (udf_fields)
保存与合同关联的用户定义字段值

示例

{
  "udf_fields": {
    "udf_long2": "1225",
    "udf_long1": "1459402730964",
    "udf_date1": {
      "display_value": "Feb 26, 2016 11:00 AM",
      "value": "1456464639051"
    },
    "udf_char1": "abc@test.com",
    "udf_char2": "Ned Stark"
  }
}

sites (site)

表示合同关联的站点列表。

sites (site)
表示合同关联的站点列表。

示例

{
  "sites": [
    {
      "id": "100000000000035025"
    }
  ]
}

auto_renew (contract_auto_renew)

表示现有合同的自动续约

auto_renew (contract_auto_renew)
表示现有合同的自动续约

示例

{
  "auto_renew": [
    {
      "auto_renew_extension": {
        "period": "months",
        "prolongation": 2
      },
      "auto_renew_notify": [
        {
          "id": "2000000036237"
        }
      ]
    }
  ]
}

configuration_items (configuration_item)

表示合同中涉及的配置项

configuration_items (configuration_item)
表示合同中涉及的配置项

示例

{
  "configuration_items": [
    {
      "id": "100000000000039173"
    }
  ]
}

services (service)

表示可用服务列表。

services (service)
表示可用服务列表。

示例

{
  "services": [
    {
      "id": "100000000000039141"
    }
  ]
}

people (用户)

表示用户列表

people (用户)
表示用户列表

示例

{
  "people": [
    {
      "id": "100000000000036225"
    }
  ]
}

contract_usage (contract_usage_stats)

合同使用情况表示当前合同的使用情况。

contract_usage (contract_usage_stats)
合同使用情况表示当前合同的使用情况。

示例

{
  "contract_usage": [
    {
      "invoked_by": {
        "id": "100000000000036225"
      },
      "cost": "33333",
      "invoked_on": {
        "display_value": "Mar 31, 2023 06:17 PM",
        "value": "1680266839803"
      },
      "id": "100000000000037547",
      "asset": {
        "site": {
          "id": "100000000000006130"
        },
        "name": "server",
        "id": "100000000000037235"
      }
    }
  ]
}

template (contract_template)

用于标识用于创建新合同的合同模板的唯一标识符。

template (contract_template)
用于标识用于创建新合同的合同模板的唯一标识符。

示例

{
  "template": {
    "id": "100000000000030618"
  }
}

expiry_notification (JSONObject)

包含到期通知的详细信息
show attribute

expiry_notification (JSONObject)
包含到期通知的详细信息

示例

{
  "expiry_notification": {
    "email_ids_to_notify": [
      "test@zmail.com"
    ],
    "notify_days": [
      {
        "notify_before": "1"
      }
    ],
    "notify_technicians": [
      {
        "id": "100000000000033153"
      }
    ]
  }
}

email_ids_to_notify (string)

包含合同到期时需通知的电子邮件列表

email_ids_to_notify (string)
纯文本格式。不允许使用富文本或换行符。

示例

abc.gmail.com

notify_technicians (technician)

包含合同到期时需通知的技术人员名单

notify_technicians (technician)
包含合同到期时需通知的技术人员名单

示例

{
  "notify_technicians": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

notify_days (contract_notify_day)

表示需要发送通知的提前天数

notify_days (contract_notify_day)
表示发送合同通知的提前天数

示例

{
  "notify_days": [
    {
      "notify_before": "2"
    },
    {
      "notify_before": "5"
    }
  ]
}

display_id (sequence_number)read only

用于识别合同的唯一序列号

display_id (sequence_number)
用于识别合同的唯一序列号

示例

{
  "display_id": {
    "display_value": "CON-1",
    "value": "1"
  }
}

created_by (用户)read only

表示创建合同的用户

created_by (用户)
表示创建合同的用户

示例

{
  "created_by": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

created_date (date)read only

表示合同创建日期

created_date (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

currency (currency)read only

指定合同使用的供应商货币

currency (currency)
指定合同使用的供应商货币

示例

{
  "currency": {
    "symbol": "€",
    "code": "EUR",
    "exchange_rate": "22",
    "name": "Euro",
    "id": "100000000000004126"
  }
}

status (contract_status)read only

表示合同状态,如:激活、待激活、已过期

status (contract_status)
表示合同状态

示例

{
  "status": {
    "name": "Active",
    "id": "100000000000002811"
  }
}

deleted_time (datetime)read only

表示合同被删除的日期和时间

deleted_time (datetime)
表示日期/时间的JSON对象,包含value和display_value属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

contract_renewed_from (contract)read only

表示此合同续签自的前一合同 

contract_renewed_from (contract)
表示此合同续签自的前一合同 

示例

{
  "contract_renewed_from": {
    "cost": "0",
    "display_id": {
      "display_value": "CON-5",
      "value": "5"
    },
    "vendor": {
      "id": "100000000000033225"
    },
    "name": "Contract",
    "active_till": {
      "display_value": "Feb 28, 2019",
      "value": "1551378599999"
    },
    "id": "100000000000033267",
    "active_from": {
      "display_value": "Feb 1, 2019",
      "value": "1548959400000"
    },
    "status": {
      "id": "100000000000002814"
    }
  }
}

contract_renewal_origin (long)read only

表示续签起始的根合同ID

contract_renewal_origin (long)
视为较大值的数字

示例

234759602834500

is_notification_disabled (布尔值)read only

布尔值表示此合同通知是否被禁用

is_notification_disabled (布尔值)
布尔值,可取两个可能值,true 和 false。

is_renewed (布尔值)read only

布尔值表示此合同是否已续签

is_renewed (布尔值)
布尔值,可取两个可能值,true 和 false。

summary (contract_summary)read only

包含合同摘要

summary (contract_summary)
包含合同摘要

expiry_request (request)read only

包含合同到期时创建请求的详细信息

expiry_request (request)
包含合同到期时创建请求的详细信息

示例

{
  "request": {
    "id": "100000000456783"
  }
}

notes_present (布尔值)read only

布尔值表示此合同是否有备注

notes_present (布尔值)
 布尔值表示此合同是否有备注

cost (cost)

指定合同费用

cost (cost)
指定合同费用

示例

{
  "cost": {
    "display_value": "227.27",
    "currency_symbol": "$",
    "value": 227.27272727272728,
    "secondary_currency": {
      "display_value": 5000,
      "currency_symbol": "€",
      "value": 5000
    }
  }
}

添加合同

使用此操作创建新合同。

必填字段:name、vendor、active_from、owner、is_definite

Url

<service domain|custom domain>/app/<portal>/api/v3/contracts

属性

id (long)
用于识别合同的唯一标识符

id (long)
用于识别合同的唯一标识符

示例

234759602834500

name (string)
用于识别合同的唯一名称 

name (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

vendor (vendor)
表示合同的供应商

vendor (vendor)
表示合同的供应商

示例

{
  "vendor": {
    "id": "100000000000033225"
  }
}

active_from (date)
表示合同的开始日期 

active_from (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

owner (用户)
表示合同拥有者名称 

owner (用户)
包含合同拥有者的详细信息

示例

{
  "owner": {
    "name": "test-contract_owner",
    "id": "234567890123456"
  }
}

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同。

更多属性 展开全部

comments (string)

合同描述

comments (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

support (string)

指定合同所包含的支持内容。例如:涉及的资源、提供的物资、任何条款和条件等。

support (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

active_till (date)

表示合同结束日期

active_till (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

exchange_rate (双精度数值)

指定合同成本的货币兑换率

exchange_rate (双精度数值)
指定合同成本的货币兑换率

示例

23.08

is_notification_required (布尔值)

布尔值表示是否需要此合同通知

is_notification_required (布尔值)
布尔值,可取两个可能值,true 和 false。

is_req_creation_required (布尔值)

表示合同到期时是否需要创建请求

is_req_creation_required (布尔值)
布尔值,可取两个可能值,true 和 false。

request_creation_days (long)

包含需要创建请求的提前天数

request_creation_days (long)
视为较大值的数字

示例

234759602834500

is_draft (布尔值)

布尔值表示此合同是否为草稿

is_draft (布尔值)
 布尔值表示此合同是否为草稿

is_auto_renew (布尔值)

布尔值表示此合同是否启用自动续约

is_auto_renew (布尔值)
 布尔值表示此合同是否启用自动续约

type (contract_type)

表示合同类型。例如:维护、租赁、支持、保修等。

type (contract_type)
包含合同类型的详细信息

示例

{
  "type": {
    "color": "#ff6666",
    "name": "Lease",
    "id": "100000000000002823"
  }
}

assets (contract_asset_association)

表示与合同关联的资产数组

assets (contract_asset_association)
包含关联资产的详细信息

示例

{
  "contract_asset_association": {
    "asset": {
      "name": "access point_1"
    }
  }
}

software_licenses (contract_swlicense_association)

表示与合同关联的软件许可数组

software_licenses (contract_swlicense_association)
表示与合同关联的软件许可数组

示例

{
  "contract_swlicense_association": {
    "software_license": {
      "id": "100000000000036043"
    }
  }
}

parent_contract (contract)

表示该合同作为子合同关联的合同

parent_contract (contract)
该合同作为子合同关联的合同详情

示例

{
  "parent_contract": {
    "id": "100000000000049155"
  }
}

child_contracts (contract_relationship)

包含该合同作为父合同关联的合同列表

child_contracts (contract_relationship)
包含与合同关联的子合同列表

示例

{
  "contract_relationship": {
    "child_contract": {
      "name": "Child 1"
    }
  }
}

attachments (attachment)

附加到合同的文件。最多可附加50个文件

attachments (attachment)
附加到合同的文件。

示例

{
  "attachments": [
    {
      "content_type": "application/x-unknown-mime-type",
      "size": "36171",
      "file_id": "4001",
      "name": "test_file.txt"
    }
  ]
}

udf_fields (udf_fields)

保存与合同关联的用户定义字段值

udf_fields (udf_fields)
保存与合同关联的用户定义字段值

示例

{
  "udf_fields": {
    "udf_long2": "1225",
    "udf_long1": "1459402730964",
    "udf_date1": {
      "display_value": "Feb 26, 2016 11:00 AM",
      "value": "1456464639051"
    },
    "udf_char1": "abc@test.com",
    "udf_char2": "Ned Stark"
  }
}

sites (site)

表示合同关联的站点列表。

sites (site)
表示合同关联的站点列表。

示例

{
  "sites": [
    {
      "id": "100000000000035025"
    }
  ]
}

auto_renew (contract_auto_renew)

表示现有合同的自动续约

auto_renew (contract_auto_renew)
表示现有合同的自动续约

示例

{
  "auto_renew": [
    {
      "auto_renew_extension": {
        "period": "months",
        "prolongation": 2
      },
      "auto_renew_notify": [
        {
          "id": "2000000036237"
        }
      ]
    }
  ]
}

configuration_items (configuration_item)

表示合同中涉及的配置项

configuration_items (configuration_item)
表示合同中涉及的配置项

示例

{
  "configuration_items": [
    {
      "id": "100000000000039173"
    }
  ]
}

services (service)

表示可用服务列表。

services (service)
表示可用服务列表。

示例

{
  "services": [
    {
      "id": "100000000000039141"
    }
  ]
}

people (用户)

表示用户列表

people (用户)
表示用户列表

示例

{
  "people": [
    {
      "id": "100000000000036225"
    }
  ]
}

contract_usage (contract_usage_stats)

合同使用情况表示当前合同的使用情况。

contract_usage (contract_usage_stats)
合同使用情况表示当前合同的使用情况。

示例

{
  "contract_usage": [
    {
      "invoked_by": {
        "id": "100000000000036225"
      },
      "cost": "33333",
      "invoked_on": {
        "display_value": "Mar 31, 2023 06:17 PM",
        "value": "1680266839803"
      },
      "id": "100000000000037547",
      "asset": {
        "site": {
          "id": "100000000000006130"
        },
        "name": "server",
        "id": "100000000000037235"
      }
    }
  ]
}

template (contract_template)

用于标识用于创建新合同的合同模板的唯一标识符。

template (contract_template)
用于标识用于创建新合同的合同模板的唯一标识符。

示例

{
  "template": {
    "id": "100000000000030618"
  }
}

expiry_notification (JSONObject)

包含到期通知的详细信息
show attribute

expiry_notification (JSONObject)
包含到期通知的详细信息

示例

{
  "expiry_notification": {
    "email_ids_to_notify": [
      "test@zmail.com"
    ],
    "notify_days": [
      {
        "notify_before": "1"
      }
    ],
    "notify_technicians": [
      {
        "id": "100000000000033153"
      }
    ]
  }
}

email_ids_to_notify (string)

包含合同到期时需通知的电子邮件列表

email_ids_to_notify (string)
纯文本格式。不允许使用富文本或换行符。

示例

abc.gmail.com

notify_technicians (technician)

包含合同到期时需通知的技术人员名单

notify_technicians (technician)
包含合同到期时需通知的技术人员名单

示例

{
  "notify_technicians": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

notify_days (contract_notify_day)

表示需要发送通知的提前天数

notify_days (contract_notify_day)
表示发送合同通知的提前天数

示例

{
  "notify_days": [
    {
      "notify_before": "2"
    },
    {
      "notify_before": "5"
    }
  ]
}

display_id (sequence_number)read only

用于识别合同的唯一序列号

display_id (sequence_number)
用于识别合同的唯一序列号

示例

{
  "display_id": {
    "display_value": "CON-1",
    "value": "1"
  }
}

created_by (用户)read only

表示创建合同的用户

created_by (用户)
表示创建合同的用户

示例

{
  "created_by": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

created_date (date)read only

表示合同创建日期

created_date (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

currency (currency)read only

指定合同使用的供应商货币

currency (currency)
指定合同使用的供应商货币

示例

{
  "currency": {
    "symbol": "€",
    "code": "EUR",
    "exchange_rate": "22",
    "name": "Euro",
    "id": "100000000000004126"
  }
}

status (contract_status)read only

表示合同状态,如:激活、待激活、已过期

status (contract_status)
表示合同状态

示例

{
  "status": {
    "name": "Active",
    "id": "100000000000002811"
  }
}

deleted_time (datetime)read only

表示合同被删除的日期和时间

deleted_time (datetime)
表示日期/时间的JSON对象,包含value和display_value属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

contract_renewed_from (contract)read only

表示此合同续签自的前一合同 

contract_renewed_from (contract)
表示此合同续签自的前一合同 

示例

{
  "contract_renewed_from": {
    "cost": "0",
    "display_id": {
      "display_value": "CON-5",
      "value": "5"
    },
    "vendor": {
      "id": "100000000000033225"
    },
    "name": "Contract",
    "active_till": {
      "display_value": "Feb 28, 2019",
      "value": "1551378599999"
    },
    "id": "100000000000033267",
    "active_from": {
      "display_value": "Feb 1, 2019",
      "value": "1548959400000"
    },
    "status": {
      "id": "100000000000002814"
    }
  }
}

contract_renewal_origin (long)read only

表示续签起始的根合同ID

contract_renewal_origin (long)
视为较大值的数字

示例

234759602834500

is_notification_disabled (布尔值)read only

布尔值表示此合同通知是否被禁用

is_notification_disabled (布尔值)
布尔值,可取两个可能值,true 和 false。

is_renewed (布尔值)read only

布尔值表示此合同是否已续签

is_renewed (布尔值)
布尔值,可取两个可能值,true 和 false。

summary (contract_summary)read only

包含合同摘要

summary (contract_summary)
包含合同摘要

expiry_request (request)read only

包含合同到期时创建请求的详细信息

expiry_request (request)
包含合同到期时创建请求的详细信息

示例

{
  "request": {
    "id": "100000000456783"
  }
}

notes_present (布尔值)read only

布尔值表示此合同是否有备注

notes_present (布尔值)
 布尔值表示此合同是否有备注

cost (cost)

指定合同费用

cost (cost)
指定合同费用

示例

{
  "cost": {
    "display_value": "227.27",
    "currency_symbol": "$",
    "value": 227.27272727272728,
    "secondary_currency": {
      "display_value": 5000,
      "currency_symbol": "€",
      "value": 5000
    }
  }
}

$ 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}

属性

id (long)
用于识别合同的唯一标识符

id (long)
用于识别合同的唯一标识符

示例

234759602834500

name (string)
用于识别合同的唯一名称 

name (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

vendor (vendor)
表示合同的供应商

vendor (vendor)
表示合同的供应商

示例

{
  "vendor": {
    "id": "100000000000033225"
  }
}

active_from (date)
表示合同的开始日期 

active_from (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

owner (用户)
表示合同拥有者名称 

owner (用户)
包含合同拥有者的详细信息

示例

{
  "owner": {
    "name": "test-contract_owner",
    "id": "234567890123456"
  }
}

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同。

更多属性 展开全部

comments (string)

合同描述

comments (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

support (string)

指定合同所包含的支持内容。例如:涉及的资源、提供的物资、任何条款和条件等。

support (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

active_till (date)

表示合同结束日期

active_till (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

exchange_rate (双精度数值)

指定合同成本的货币兑换率

exchange_rate (双精度数值)
指定合同成本的货币兑换率

示例

23.08

is_notification_required (布尔值)

布尔值表示是否需要此合同通知

is_notification_required (布尔值)
布尔值,可取两个可能值,true 和 false。

is_req_creation_required (布尔值)

表示合同到期时是否需要创建请求

is_req_creation_required (布尔值)
布尔值,可取两个可能值,true 和 false。

request_creation_days (long)

包含需要创建请求的提前天数

request_creation_days (long)
视为较大值的数字

示例

234759602834500

is_draft (布尔值)

布尔值表示此合同是否为草稿

is_draft (布尔值)
 布尔值表示此合同是否为草稿

is_auto_renew (布尔值)

布尔值表示此合同是否启用自动续约

is_auto_renew (布尔值)
 布尔值表示此合同是否启用自动续约

type (contract_type)

表示合同类型。例如:维护、租赁、支持、保修等。

type (contract_type)
包含合同类型的详细信息

示例

{
  "type": {
    "color": "#ff6666",
    "name": "Lease",
    "id": "100000000000002823"
  }
}

assets (contract_asset_association)

表示与合同关联的资产数组

assets (contract_asset_association)
包含关联资产的详细信息

示例

{
  "contract_asset_association": {
    "asset": {
      "name": "access point_1"
    }
  }
}

software_licenses (contract_swlicense_association)

表示与合同关联的软件许可数组

software_licenses (contract_swlicense_association)
表示与合同关联的软件许可数组

示例

{
  "contract_swlicense_association": {
    "software_license": {
      "id": "100000000000036043"
    }
  }
}

parent_contract (contract)

表示该合同作为子合同关联的合同

parent_contract (contract)
该合同作为子合同关联的合同详情

示例

{
  "parent_contract": {
    "id": "100000000000049155"
  }
}

child_contracts (contract_relationship)

包含该合同作为父合同关联的合同列表

child_contracts (contract_relationship)
包含与合同关联的子合同列表

示例

{
  "contract_relationship": {
    "child_contract": {
      "name": "Child 1"
    }
  }
}

attachments (attachment)

附加到合同的文件。最多可附加50个文件

attachments (attachment)
附加到合同的文件。

示例

{
  "attachments": [
    {
      "content_type": "application/x-unknown-mime-type",
      "size": "36171",
      "file_id": "4001",
      "name": "test_file.txt"
    }
  ]
}

udf_fields (udf_fields)

保存与合同关联的用户定义字段值

udf_fields (udf_fields)
保存与合同关联的用户定义字段值

示例

{
  "udf_fields": {
    "udf_long2": "1225",
    "udf_long1": "1459402730964",
    "udf_date1": {
      "display_value": "Feb 26, 2016 11:00 AM",
      "value": "1456464639051"
    },
    "udf_char1": "abc@test.com",
    "udf_char2": "Ned Stark"
  }
}

sites (site)

表示合同关联的站点列表。

sites (site)
表示合同关联的站点列表。

示例

{
  "sites": [
    {
      "id": "100000000000035025"
    }
  ]
}

auto_renew (contract_auto_renew)

表示现有合同的自动续约

auto_renew (contract_auto_renew)
表示现有合同的自动续约

示例

{
  "auto_renew": [
    {
      "auto_renew_extension": {
        "period": "months",
        "prolongation": 2
      },
      "auto_renew_notify": [
        {
          "id": "2000000036237"
        }
      ]
    }
  ]
}

configuration_items (configuration_item)

表示合同中涉及的配置项

configuration_items (configuration_item)
表示合同中涉及的配置项

示例

{
  "configuration_items": [
    {
      "id": "100000000000039173"
    }
  ]
}

services (service)

表示可用服务列表。

services (service)
表示可用服务列表。

示例

{
  "services": [
    {
      "id": "100000000000039141"
    }
  ]
}

people (用户)

表示用户列表

people (用户)
表示用户列表

示例

{
  "people": [
    {
      "id": "100000000000036225"
    }
  ]
}

contract_usage (contract_usage_stats)

合同使用情况表示当前合同的使用情况。

contract_usage (contract_usage_stats)
合同使用情况表示当前合同的使用情况。

示例

{
  "contract_usage": [
    {
      "invoked_by": {
        "id": "100000000000036225"
      },
      "cost": "33333",
      "invoked_on": {
        "display_value": "Mar 31, 2023 06:17 PM",
        "value": "1680266839803"
      },
      "id": "100000000000037547",
      "asset": {
        "site": {
          "id": "100000000000006130"
        },
        "name": "server",
        "id": "100000000000037235"
      }
    }
  ]
}

template (contract_template)

用于标识用于创建新合同的合同模板的唯一标识符。

template (contract_template)
用于标识用于创建新合同的合同模板的唯一标识符。

示例

{
  "template": {
    "id": "100000000000030618"
  }
}

expiry_notification (JSONObject)

包含到期通知的详细信息
show attribute

expiry_notification (JSONObject)
包含到期通知的详细信息

示例

{
  "expiry_notification": {
    "email_ids_to_notify": [
      "test@zmail.com"
    ],
    "notify_days": [
      {
        "notify_before": "1"
      }
    ],
    "notify_technicians": [
      {
        "id": "100000000000033153"
      }
    ]
  }
}

email_ids_to_notify (string)

包含合同到期时需通知的电子邮件列表

email_ids_to_notify (string)
纯文本格式。不允许使用富文本或换行符。

示例

abc.gmail.com

notify_technicians (technician)

包含合同到期时需通知的技术人员名单

notify_technicians (technician)
包含合同到期时需通知的技术人员名单

示例

{
  "notify_technicians": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

notify_days (contract_notify_day)

表示需要发送通知的提前天数

notify_days (contract_notify_day)
表示发送合同通知的提前天数

示例

{
  "notify_days": [
    {
      "notify_before": "2"
    },
    {
      "notify_before": "5"
    }
  ]
}

display_id (sequence_number)read only

用于识别合同的唯一序列号

display_id (sequence_number)
用于识别合同的唯一序列号

示例

{
  "display_id": {
    "display_value": "CON-1",
    "value": "1"
  }
}

created_by (用户)read only

表示创建合同的用户

created_by (用户)
表示创建合同的用户

示例

{
  "created_by": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

created_date (date)read only

表示合同创建日期

created_date (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

currency (currency)read only

指定合同使用的供应商货币

currency (currency)
指定合同使用的供应商货币

示例

{
  "currency": {
    "symbol": "€",
    "code": "EUR",
    "exchange_rate": "22",
    "name": "Euro",
    "id": "100000000000004126"
  }
}

status (contract_status)read only

表示合同状态,如:激活、待激活、已过期

status (contract_status)
表示合同状态

示例

{
  "status": {
    "name": "Active",
    "id": "100000000000002811"
  }
}

deleted_time (datetime)read only

表示合同被删除的日期和时间

deleted_time (datetime)
表示日期/时间的JSON对象,包含value和display_value属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

contract_renewed_from (contract)read only

表示此合同续签自的前一合同 

contract_renewed_from (contract)
表示此合同续签自的前一合同 

示例

{
  "contract_renewed_from": {
    "cost": "0",
    "display_id": {
      "display_value": "CON-5",
      "value": "5"
    },
    "vendor": {
      "id": "100000000000033225"
    },
    "name": "Contract",
    "active_till": {
      "display_value": "Feb 28, 2019",
      "value": "1551378599999"
    },
    "id": "100000000000033267",
    "active_from": {
      "display_value": "Feb 1, 2019",
      "value": "1548959400000"
    },
    "status": {
      "id": "100000000000002814"
    }
  }
}

contract_renewal_origin (long)read only

表示续签起始的根合同ID

contract_renewal_origin (long)
视为较大值的数字

示例

234759602834500

is_notification_disabled (布尔值)read only

布尔值表示此合同通知是否被禁用

is_notification_disabled (布尔值)
布尔值,可取两个可能值,true 和 false。

is_renewed (布尔值)read only

布尔值表示此合同是否已续签

is_renewed (布尔值)
布尔值,可取两个可能值,true 和 false。

summary (contract_summary)read only

包含合同摘要

summary (contract_summary)
包含合同摘要

expiry_request (request)read only

包含合同到期时创建请求的详细信息

expiry_request (request)
包含合同到期时创建请求的详细信息

示例

{
  "request": {
    "id": "100000000456783"
  }
}

notes_present (布尔值)read only

布尔值表示此合同是否有备注

notes_present (布尔值)
 布尔值表示此合同是否有备注

cost (cost)

指定合同费用

cost (cost)
指定合同费用

示例

{
  "cost": {
    "display_value": "227.27",
    "currency_symbol": "$",
    "value": 227.27272727272728,
    "secondary_currency": {
      "display_value": 5000,
      "currency_symbol": "€",
      "value": 5000
    }
  }
}

$ 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}

属性

id (long)
用于识别合同的唯一标识符

id (long)
用于识别合同的唯一标识符

示例

234759602834500

name (string)
用于识别合同的唯一名称 

name (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

vendor (vendor)
表示合同的供应商

vendor (vendor)
表示合同的供应商

示例

{
  "vendor": {
    "id": "100000000000033225"
  }
}

active_from (date)
表示合同的开始日期 

active_from (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

owner (用户)
表示合同拥有者名称 

owner (用户)
包含合同拥有者的详细信息

示例

{
  "owner": {
    "name": "test-contract_owner",
    "id": "234567890123456"
  }
}

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同,即 true/false

is_definite (布尔值)
表示合同是确定期限合同还是不定期限合同。

更多属性 展开全部

comments (string)

合同描述

comments (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

support (string)

指定合同所包含的支持内容。例如:涉及的资源、提供的物资、任何条款和条件等。

support (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

active_till (date)

表示合同结束日期

active_till (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

exchange_rate (双精度数值)

指定合同成本的货币兑换率

exchange_rate (双精度数值)
指定合同成本的货币兑换率

示例

23.08

is_notification_required (布尔值)

布尔值表示是否需要此合同通知

is_notification_required (布尔值)
布尔值,可取两个可能值,true 和 false。

is_req_creation_required (布尔值)

表示合同到期时是否需要创建请求

is_req_creation_required (布尔值)
布尔值,可取两个可能值,true 和 false。

request_creation_days (long)

包含需要创建请求的提前天数

request_creation_days (long)
视为较大值的数字

示例

234759602834500

is_draft (布尔值)

布尔值表示此合同是否为草稿

is_draft (布尔值)
 布尔值表示此合同是否为草稿

is_auto_renew (布尔值)

布尔值表示此合同是否启用自动续约

is_auto_renew (布尔值)
 布尔值表示此合同是否启用自动续约

type (contract_type)

表示合同类型。例如:维护、租赁、支持、保修等。

type (contract_type)
包含合同类型的详细信息

示例

{
  "type": {
    "color": "#ff6666",
    "name": "Lease",
    "id": "100000000000002823"
  }
}

assets (contract_asset_association)

表示与合同关联的资产数组

assets (contract_asset_association)
包含关联资产的详细信息

示例

{
  "contract_asset_association": {
    "asset": {
      "name": "access point_1"
    }
  }
}

software_licenses (contract_swlicense_association)

表示与合同关联的软件许可数组

software_licenses (contract_swlicense_association)
表示与合同关联的软件许可数组

示例

{
  "contract_swlicense_association": {
    "software_license": {
      "id": "100000000000036043"
    }
  }
}

parent_contract (contract)

表示该合同作为子合同关联的合同

parent_contract (contract)
该合同作为子合同关联的合同详情

示例

{
  "parent_contract": {
    "id": "100000000000049155"
  }
}

child_contracts (contract_relationship)

包含该合同作为父合同关联的合同列表

child_contracts (contract_relationship)
包含与合同关联的子合同列表

示例

{
  "contract_relationship": {
    "child_contract": {
      "name": "Child 1"
    }
  }
}

attachments (attachment)

附加到合同的文件。最多可附加50个文件

attachments (attachment)
附加到合同的文件。

示例

{
  "attachments": [
    {
      "content_type": "application/x-unknown-mime-type",
      "size": "36171",
      "file_id": "4001",
      "name": "test_file.txt"
    }
  ]
}

udf_fields (udf_fields)

保存与合同关联的用户定义字段值

udf_fields (udf_fields)
保存与合同关联的用户定义字段值

示例

{
  "udf_fields": {
    "udf_long2": "1225",
    "udf_long1": "1459402730964",
    "udf_date1": {
      "display_value": "Feb 26, 2016 11:00 AM",
      "value": "1456464639051"
    },
    "udf_char1": "abc@test.com",
    "udf_char2": "Ned Stark"
  }
}

sites (site)

表示合同关联的站点列表。

sites (site)
表示合同关联的站点列表。

示例

{
  "sites": [
    {
      "id": "100000000000035025"
    }
  ]
}

auto_renew (contract_auto_renew)

表示现有合同的自动续约

auto_renew (contract_auto_renew)
表示现有合同的自动续约

示例

{
  "auto_renew": [
    {
      "auto_renew_extension": {
        "period": "months",
        "prolongation": 2
      },
      "auto_renew_notify": [
        {
          "id": "2000000036237"
        }
      ]
    }
  ]
}

configuration_items (configuration_item)

表示合同中涉及的配置项

configuration_items (configuration_item)
表示合同中涉及的配置项

示例

{
  "configuration_items": [
    {
      "id": "100000000000039173"
    }
  ]
}

services (service)

表示可用服务列表。

services (service)
表示可用服务列表。

示例

{
  "services": [
    {
      "id": "100000000000039141"
    }
  ]
}

people (用户)

表示用户列表

people (用户)
表示用户列表

示例

{
  "people": [
    {
      "id": "100000000000036225"
    }
  ]
}

contract_usage (contract_usage_stats)

合同使用情况表示当前合同的使用情况。

contract_usage (contract_usage_stats)
合同使用情况表示当前合同的使用情况。

示例

{
  "contract_usage": [
    {
      "invoked_by": {
        "id": "100000000000036225"
      },
      "cost": "33333",
      "invoked_on": {
        "display_value": "Mar 31, 2023 06:17 PM",
        "value": "1680266839803"
      },
      "id": "100000000000037547",
      "asset": {
        "site": {
          "id": "100000000000006130"
        },
        "name": "server",
        "id": "100000000000037235"
      }
    }
  ]
}

template (contract_template)

用于标识用于创建新合同的合同模板的唯一标识符。

template (contract_template)
用于标识用于创建新合同的合同模板的唯一标识符。

示例

{
  "template": {
    "id": "100000000000030618"
  }
}

expiry_notification (JSONObject)

包含到期通知的详细信息
show attribute

expiry_notification (JSONObject)
包含到期通知的详细信息

示例

{
  "expiry_notification": {
    "email_ids_to_notify": [
      "test@zmail.com"
    ],
    "notify_days": [
      {
        "notify_before": "1"
      }
    ],
    "notify_technicians": [
      {
        "id": "100000000000033153"
      }
    ]
  }
}

email_ids_to_notify (string)

包含合同到期时需通知的电子邮件列表

email_ids_to_notify (string)
纯文本格式。不允许使用富文本或换行符。

示例

abc.gmail.com

notify_technicians (technician)

包含合同到期时需通知的技术人员名单

notify_technicians (technician)
包含合同到期时需通知的技术人员名单

示例

{
  "notify_technicians": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

notify_days (contract_notify_day)

表示需要发送通知的提前天数

notify_days (contract_notify_day)
表示发送合同通知的提前天数

示例

{
  "notify_days": [
    {
      "notify_before": "2"
    },
    {
      "notify_before": "5"
    }
  ]
}

display_id (sequence_number)read only

用于识别合同的唯一序列号

display_id (sequence_number)
用于识别合同的唯一序列号

示例

{
  "display_id": {
    "display_value": "CON-1",
    "value": "1"
  }
}

created_by (用户)read only

表示创建合同的用户

created_by (用户)
表示创建合同的用户

示例

{
  "created_by": {
    "email_id": "ramyaa@zylker.com",
    "name": "test-created_by",
    "id": "234567890123456"
  }
}

created_date (date)read only

表示合同创建日期

created_date (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

currency (currency)read only

指定合同使用的供应商货币

currency (currency)
指定合同使用的供应商货币

示例

{
  "currency": {
    "symbol": "€",
    "code": "EUR",
    "exchange_rate": "22",
    "name": "Euro",
    "id": "100000000000004126"
  }
}

status (contract_status)read only

表示合同状态,如:激活、待激活、已过期

status (contract_status)
表示合同状态

示例

{
  "status": {
    "name": "Active",
    "id": "100000000000002811"
  }
}

deleted_time (datetime)read only

表示合同被删除的日期和时间

deleted_time (datetime)
表示日期/时间的JSON对象,包含value和display_value属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

contract_renewed_from (contract)read only

表示此合同续签自的前一合同 

contract_renewed_from (contract)
表示此合同续签自的前一合同 

示例

{
  "contract_renewed_from": {
    "cost": "0",
    "display_id": {
      "display_value": "CON-5",
      "value": "5"
    },
    "vendor": {
      "id": "100000000000033225"
    },
    "name": "Contract",
    "active_till": {
      "display_value": "Feb 28, 2019",
      "value": "1551378599999"
    },
    "id": "100000000000033267",
    "active_from": {
      "display_value": "Feb 1, 2019",
      "value": "1548959400000"
    },
    "status": {
      "id": "100000000000002814"
    }
  }
}

contract_renewal_origin (long)read only

表示续签起始的根合同ID

contract_renewal_origin (long)
视为较大值的数字

示例

234759602834500

is_notification_disabled (布尔值)read only

布尔值表示此合同通知是否被禁用

is_notification_disabled (布尔值)
布尔值,可取两个可能值,true 和 false。

is_renewed (布尔值)read only

布尔值表示此合同是否已续签

is_renewed (布尔值)
布尔值,可取两个可能值,true 和 false。

summary (contract_summary)read only

包含合同摘要

summary (contract_summary)
包含合同摘要

expiry_request (request)read only

包含合同到期时创建请求的详细信息

expiry_request (request)
包含合同到期时创建请求的详细信息

示例

{
  "request": {
    "id": "100000000456783"
  }
}

notes_present (布尔值)read only

布尔值表示此合同是否有备注

notes_present (布尔值)
 布尔值表示此合同是否有备注

cost (cost)

指定合同费用

cost (cost)
指定合同费用

示例

{
  "cost": {
    "display_value": "227.27",
    "currency_symbol": "$",
    "value": 227.27272727272728,
    "secondary_currency": {
      "display_value": 5000,
      "currency_symbol": "€",
      "value": 5000
    }
  }
}

$ 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

属性

id (long)
用于识别合同的唯一标识符

id (long)
用于识别合同的唯一标识符

示例

234759602834500

name (string)
用于识别合同的唯一名称 

name (string)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

vendor (vendor)
表示合同的供应商

vendor (vendor)
表示合同的供应商

示例

{
  "vendor": {
    "id": "100000000000033225"
  }
}

active_from (date)
表示合同的开始日期 

active_from (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

owner (用户)
表示合同拥有者名称 

owner (用户)
包含合同拥有者的详细信息

示例

{
  "owner": {
    "name": "test-contract_owner",
    "id": "234567890123456"
  }
}

active_till (date)
表示合同结束日期

active_till (date)
用 JSON 对象表示日期。包含 value 和 display_value 属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

更多属性 展开全部

request_creation_days (long)

包含需要创建请求的提前天数

request_creation_days (long)
视为较大值的数字

示例

234759602834500

type (contract_type)

表示合同类型。例如:维护、租赁、支持、保修等。

type (contract_type)
包含合同类型的详细信息

示例

{
  "type": {
    "color": "#ff6666",
    "name": "Lease",
    "id": "100000000000002823"
  }
}

assets (contract_asset_association)

表示与合同关联的资产数组

assets (contract_asset_association)
包含关联资产的详细信息

示例

{
  "contract_asset_association": {
    "asset": {
      "name": "access point_1"
    }
  }
}

software_licenses (contract_swlicense_association)

表示与合同关联的软件许可数组

software_licenses (contract_swlicense_association)
表示与合同关联的软件许可数组

示例

{
  "contract_swlicense_association": {
    "software_license": {
      "id": "100000000000036043"
    }
  }
}

attachments (attachment)

附加到合同的文件。最多可附加50个文件

attachments (attachment)
附加到合同的文件。

示例

{
  "attachments": [
    {
      "content_type": "application/x-unknown-mime-type",
      "size": "36171",
      "file_id": "4001",
      "name": "test_file.txt"
    }
  ]
}

udf_fields (udf_fields)

保存与合同关联的用户定义字段值

udf_fields (udf_fields)
保存与合同关联的用户定义字段值

示例

{
  "udf_fields": {
    "udf_long2": "1225",
    "udf_long1": "1459402730964",
    "udf_date1": {
      "display_value": "Feb 26, 2016 11:00 AM",
      "value": "1456464639051"
    },
    "udf_char1": "abc@test.com",
    "udf_char2": "Ned Stark"
  }
}

sites (site)

表示合同关联的站点列表。

sites (site)
表示合同关联的站点列表。

示例

{
  "sites": [
    {
      "id": "100000000000035025"
    }
  ]
}

auto_renew (contract_auto_renew)

表示现有合同的自动续约

auto_renew (contract_auto_renew)
表示现有合同的自动续约

示例

{
  "auto_renew": [
    {
      "auto_renew_extension": {
        "period": "months",
        "prolongation": 2
      },
      "auto_renew_notify": [
        {
          "id": "2000000036237"
        }
      ]
    }
  ]
}

configuration_items (configuration_item)

表示合同中涉及的配置项

configuration_items (configuration_item)
表示合同中涉及的配置项

示例

{
  "configuration_items": [
    {
      "id": "100000000000039173"
    }
  ]
}

services (service)

表示可用服务列表。

services (service)
表示可用服务列表。

示例

{
  "services": [
    {
      "id": "100000000000039141"
    }
  ]
}

people (用户)

表示用户列表

people (用户)
表示用户列表

示例

{
  "people": [
    {
      "id": "100000000000036225"
    }
  ]
}

contract_usage (contract_usage_stats)

合同使用情况表示当前合同的使用情况。

contract_usage (contract_usage_stats)
合同使用情况表示当前合同的使用情况。

示例

{
  "contract_usage": [
    {
      "invoked_by": {
        "id": "100000000000036225"
      },
      "cost": "33333",
      "invoked_on": {
        "display_value": "Mar 31, 2023 06:17 PM",
        "value": "1680266839803"
      },
      "id": "100000000000037547",
      "asset": {
        "site": {
          "id": "100000000000006130"
        },
        "name": "server",
        "id": "100000000000037235"
      }
    }
  ]
}

template (contract_template)

用于标识用于创建新合同的合同模板的唯一标识符。

template (contract_template)
用于标识用于创建新合同的合同模板的唯一标识符。

示例

{
  "template": {
    "id": "100000000000030618"
  }
}

display_id (sequence_number)read only

用于识别合同的唯一序列号

display_id (sequence_number)
用于识别合同的唯一序列号

示例

{
  "display_id": {
    "display_value": "CON-1",
    "value": "1"
  }
}

currency (currency)read only

指定合同使用的供应商货币

currency (currency)
指定合同使用的供应商货币

示例

{
  "currency": {
    "symbol": "€",
    "code": "EUR",
    "exchange_rate": "22",
    "name": "Euro",
    "id": "100000000000004126"
  }
}

status (contract_status)read only

表示合同状态,如:激活、待激活、已过期

status (contract_status)
表示合同状态

示例

{
  "status": {
    "name": "Active",
    "id": "100000000000002811"
  }
}

deleted_time (datetime)read only

表示合同被删除的日期和时间

deleted_time (datetime)
表示日期/时间的JSON对象,包含value和display_value属性。

value :长格式的时间(自1970年1月1日以来的毫秒数)。

display_value :以用户个性化的格式显示的可读时间。若未个性化,则使用默认格式。

summary (contract_summary)read only

包含合同摘要

summary (contract_summary)
包含合同摘要

notes_present (布尔值)read only

布尔值表示此合同是否有备注

notes_present (布尔值)
 布尔值表示此合同是否有备注

cost (cost)

指定合同费用

cost (cost)
指定合同费用

示例

{
  "cost": {
    "display_value": "227.27",
    "currency_symbol": "$",
    "value": 227.27272727272728,
    "secondary_currency": {
      "display_value": 5000,
      "currency_symbol": "€",
      "value": 5000
    }
  }
}

$ 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

属性

文件名 (文件)
上传文件的路径必须以’@’开头。

文件名 (文件)
上传的文件名。

示例

test-document.txt

addtoattachment (布尔)
表示是否将文件作为附件添加到关联实体。

addtoattachment (布尔)
布尔值,可为两个可能的值。

示例

True or False

文件 (多个文件)
这里包含文件的详细信息。
show attribute

文件 (多个文件)
包含已上传文件的信息。

示例

{
  "size": "601",
  "content_type": "application/unknown-mime-type",
  "file_id": "6003",
  "name": "test-document.txt",
  "content_url": "<file path>"
  "id": "17322245500049868"
}

大小 (长整型)
上传文件的大小。

大小 (长整型)
被视为较大值的数字。

示例

234759602834500

content_type (字符串)
文件内容的类型。

content_type (字符串)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

文件ID (长整型)
file_id 用于将该文件作为附件添加到实体。

文件ID (长整型)
被视为较大值的数字。

示例

234759602834500

name (字符串)
文件名。

name (字符串)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

content_url (字符串)
上传文件的 URL。

content_url (字符串)
纯文本格式。不允许使用富文本或换行符。

示例

Sample Content

$ 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"
        }
    ]
}