<service domain|custom domain>/app/<portal>/api/v3/assets
资产
使用资产模块可以跟踪组织所有的物理和虚拟资产及其财务和生命周期详情。
属性
state_history_comments (字符串)
更改资产状态时提供的备注。
serial_number (字符串)
用于识别资产的序列号
acquisition_date (日期)
表示资产的购置日期。
更多属性 全部展开
添加资产
此操作帮助您添加资产。
必填字段:名称,产品
Url
属性
state_history_comments (字符串)
更改资产状态时提供的备注。
serial_number (字符串)
用于识别资产的序列号
acquisition_date (日期)
表示资产的购置日期。
更多属性 全部展开
$ curl <service domain|custom domain>/app/<portal>/api/v3/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='{
"asset": {
"retain_user_site": false,
"acquisition_date": {
"value": "1478758440000"
},
"vendor": {
"name": "test-name",
"id": "1762632440935269"
},
"suggested_owner": {
"name": "Lincoln",
"id": "1544077640540465"
},
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1651471221136919"
},
"department": {
"name": "Administration",
"id": "1569272846971707"
},
"barcode": "test-barcode",
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "2279871101619577"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "2061627944496758",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2248743224252246"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2022316323942908"
},
"udf_boolean1": false,
"udf_long1": "2167049216006549",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "1948848567669779"
}
},
"location": "test-location",
"is_loanable": false,
"user": {
"name": "Lincoln",
"id": "2332056023467953"
},
"state_history_comments": "test-state_history_comments"
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/assets";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"asset": {
"retain_user_site": false,
"acquisition_date": {
"value": "1478758440000"
},
"vendor": {
"name": "test-name",
"id": "1762632440935269"
},
"suggested_owner": {
"name": "Lincoln",
"id": "1544077640540465"
},
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1651471221136919"
},
"department": {
"name": "Administration",
"id": "1569272846971707"
},
"barcode": "test-barcode",
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "2279871101619577"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "2061627944496758",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2248743224252246"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2022316323942908"
},
"udf_boolean1": false,
"udf_long1": "2167049216006549",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "1948848567669779"
}
},
"location": "test-location",
"is_loanable": false,
"user": {
"name": "Lincoln",
"id": "2332056023467953"
},
"state_history_comments": "test-state_history_comments"
}
};
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/assets"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
"asset": {
"retain_user_site": false,
"acquisition_date": {
"value": "1478758440000"
},
"vendor": {
"name": "test-name",
"id": "1762632440935269"
},
"suggested_owner": {
"name": "Lincoln",
"id": "1544077640540465"
},
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1651471221136919"
},
"department": {
"name": "Administration",
"id": "1569272846971707"
},
"barcode": "test-barcode",
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "2279871101619577"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "2061627944496758",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2248743224252246"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2022316323942908"
},
"udf_boolean1": false,
"udf_long1": "2167049216006549",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "1948848567669779"
}
},
"location": "test-location",
"is_loanable": false,
"user": {
"name": "Lincoln",
"id": "2332056023467953"
},
"state_history_comments": "test-state_history_comments"
}
}
'@
$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/assets"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"asset": {
"retain_user_site": false,
"acquisition_date": {
"value": "1478758440000"
},
"vendor": {
"name": "test-name",
"id": "1762632440935269"
},
"suggested_owner": {
"name": "Lincoln",
"id": "1544077640540465"
},
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1651471221136919"
},
"department": {
"name": "Administration",
"id": "1569272846971707"
},
"barcode": "test-barcode",
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "2279871101619577"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "2061627944496758",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2248743224252246"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2022316323942908"
},
"udf_boolean1": false,
"udf_long1": "2167049216006549",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "1948848567669779"
}
},
"location": "test-location",
"is_loanable": false,
"user": {
"name": "Lincoln",
"id": "2332056023467953"
},
"state_history_comments": "test-state_history_comments"
}
}'''
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"
},
"asset": {
"loan": {
"start_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"id": "1794378589216650",
"returned_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"barcode": "test-barcode",
"due_by_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"loan_id": {
"display_value": "CH 44",
"value": "44"
}
},
"total_cost": 1343434.4333,
"retain_user_site": false,
"type": {
"name": "Asset",
"id": "1694816465765730"
},
"acquisition_date": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"current_cost": 1343434.4333,
"mac_address": "test-mac_address",
"vendor": {
"name": "test-name",
"description": "test-description",
"id": "1762632440935269"
},
"suggested_owner": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1544077640540465",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"id": "1705443869314617",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"description": "test-description",
"id": "1651471221136919"
},
"department": {
"name": "Administration",
"id": "1569272846971707"
},
"barcode": "test-barcode",
"product_depreciation": {
"useful_life": "1884664181507407",
"id": "1887553156383214",
"depreciation_percent": 1343434.4333,
"salvage_value": 1343434.4333
},
"operational_cost": 1343434.4333,
"asset_tag": "test-asset_tag",
"created_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"is_in_contract": false,
"product": {
"part_no": "test-part_no",
"name": "test-name",
"id": "2279871101619577",
"manufacturer": "test-manufacturer"
},
"asset_depreciation": {
"useful_life": "2372788052263184",
"id": "2332434326383660",
"depreciation_percent": 1343434.4333,
"salvage_value": 1343434.4333
},
"expiry_date": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "2061627944496758",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"ip_address": "test-ip_address",
"created_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1496847786447050",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"site": {
"deleted": false,
"name": "Custom Site",
"id": "2248743224252246"
},
"product_type": {
"image": "test-image",
"name": "Workstation",
"id": "2133479715812885"
},
"purchase_order": "test-purchase_order",
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2022316323942908"
},
"udf_boolean1": false,
"udf_long1": "2167049216006549",
"udf_date1": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "1948848567669779"
}
},
"is_depreciation_configured": false,
"discovered_serial_number": "test-discovered_serial_number",
"location": "test-location",
"is_loaned": false,
"is_loanable": false,
"is_depreciation_calculated": false,
"category": {
"name": "IT",
"description": "test-description",
"id": "1727197951644696"
},
"region": {
"name": "test-name",
"id": "1817558050116230"
},
"user": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "2332056023467953",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"last_success_audit": {
"description": "test-description",
"id": "1560914354969749",
"time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"status": "test-status"
},
"state_history_comments": "test-state_history_comments",
"last_audit": {
"description": "test-description",
"id": "1579144827714947",
"time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"status": "test-status"
}
}
}
编辑资产
此操作帮助您编辑资产。
Url
<service domain|custom domain>/app/<portal>/api/v3/assets/{asset_id}
属性
state_history_comments (字符串)
更改资产状态时提供的备注。
serial_number (字符串)
用于识别资产的序列号
acquisition_date (日期)
表示资产的购置日期。
更多属性 全部展开
$ curl <service domain|custom domain>/app/<portal>/api/v3/assets/{asset_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='{
"asset": {
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "1538924561770181"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "1615161639482026",
"barcode": "test-barcode"
},
"retain_user_site": false,
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"acquisition_date": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2008272288144379"
},
"vendor": {
"name": "test-name",
"id": "1508598106138405"
},
"suggested_owner": {
"name": "Lincoln",
"id": "2333210300238087"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2265213289869560"
},
"udf_boolean1": false,
"udf_long1": "1806793859686494",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "2175045251780693"
}
},
"location": "test-location",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1850985561780658"
},
"is_loanable": false,
"department": {
"name": "Administration",
"id": "1596297793459486"
},
"barcode": "test-barcode",
"user": {
"name": "Lincoln",
"id": "1498540603148390"
},
"state_history_comments": "test-state_history_comments"
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/assets/{asset_id}";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"asset": {
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "1538924561770181"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "1615161639482026",
"barcode": "test-barcode"
},
"retain_user_site": false,
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"acquisition_date": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2008272288144379"
},
"vendor": {
"name": "test-name",
"id": "1508598106138405"
},
"suggested_owner": {
"name": "Lincoln",
"id": "2333210300238087"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2265213289869560"
},
"udf_boolean1": false,
"udf_long1": "1806793859686494",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "2175045251780693"
}
},
"location": "test-location",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1850985561780658"
},
"is_loanable": false,
"department": {
"name": "Administration",
"id": "1596297793459486"
},
"barcode": "test-barcode",
"user": {
"name": "Lincoln",
"id": "1498540603148390"
},
"state_history_comments": "test-state_history_comments"
}
};
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/assets/{asset_id}"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"asset": {
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "1538924561770181"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "1615161639482026",
"barcode": "test-barcode"
},
"retain_user_site": false,
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"acquisition_date": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2008272288144379"
},
"vendor": {
"name": "test-name",
"id": "1508598106138405"
},
"suggested_owner": {
"name": "Lincoln",
"id": "2333210300238087"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2265213289869560"
},
"udf_boolean1": false,
"udf_long1": "1806793859686494",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "2175045251780693"
}
},
"location": "test-location",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1850985561780658"
},
"is_loanable": false,
"department": {
"name": "Administration",
"id": "1596297793459486"
},
"barcode": "test-barcode",
"user": {
"name": "Lincoln",
"id": "1498540603148390"
},
"state_history_comments": "test-state_history_comments"
}
}
'@
$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/assets/{asset_id}"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"asset": {
"asset_tag": "test-asset_tag",
"product": {
"name": "test-name",
"id": "1538924561770181"
},
"expiry_date": {
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "1615161639482026",
"barcode": "test-barcode"
},
"retain_user_site": false,
"serial_number": "test-serial_number",
"warranty_expiry": {
"value": "1478758440000"
},
"acquisition_date": {
"value": "1478758440000"
},
"site": {
"name": "Custom Site",
"id": "2008272288144379"
},
"vendor": {
"name": "test-name",
"id": "1508598106138405"
},
"suggested_owner": {
"name": "Lincoln",
"id": "2333210300238087"
},
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2265213289869560"
},
"udf_boolean1": false,
"udf_long1": "1806793859686494",
"udf_date1": {
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "2175045251780693"
}
},
"location": "test-location",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"id": "1850985561780658"
},
"is_loanable": false,
"department": {
"name": "Administration",
"id": "1596297793459486"
},
"barcode": "test-barcode",
"user": {
"name": "Lincoln",
"id": "1498540603148390"
},
"state_history_comments": "test-state_history_comments"
}
}'''
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"
},
"asset": {
"loan": {
"start_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"id": "2436059452452004",
"returned_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"barcode": "test-barcode",
"due_by_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"loan_id": {
"display_value": "CH 44",
"value": "44"
}
},
"total_cost": 1343434.4333,
"retain_user_site": false,
"type": {
"name": "Asset",
"id": "2018933285562933"
},
"acquisition_date": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"last_updated_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1627526992794249",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"current_cost": 1343434.4333,
"mac_address": "test-mac_address",
"vendor": {
"name": "test-name",
"description": "test-description",
"id": "1508598106138405"
},
"suggested_owner": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "2333210300238087",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"id": "1811130946886149",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"description": "test-description",
"id": "1850985561780658"
},
"department": {
"name": "Administration",
"id": "1596297793459486"
},
"barcode": "test-barcode",
"product_depreciation": {
"useful_life": "1891194435952305",
"id": "1863910267324447",
"depreciation_percent": 1343434.4333,
"salvage_value": 1343434.4333
},
"operational_cost": 1343434.4333,
"asset_tag": "test-asset_tag",
"created_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"is_in_contract": false,
"product": {
"part_no": "test-part_no",
"name": "test-name",
"id": "1538924561770181",
"manufacturer": "test-manufacturer"
},
"asset_depreciation": {
"useful_life": "1514169621635118",
"id": "2155596492095710",
"depreciation_percent": 1343434.4333,
"salvage_value": 1343434.4333
},
"expiry_date": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "1615161639482026",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"ip_address": "test-ip_address",
"created_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1847855233440788",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"site": {
"deleted": false,
"name": "Custom Site",
"id": "2008272288144379"
},
"product_type": {
"image": "test-image",
"name": "Workstation",
"id": "1776127248585271"
},
"last_updated_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"purchase_order": "test-purchase_order",
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2265213289869560"
},
"udf_boolean1": false,
"udf_long1": "1806793859686494",
"udf_date1": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "2175045251780693"
}
},
"is_depreciation_configured": false,
"discovered_serial_number": "test-discovered_serial_number",
"location": "test-location",
"is_loaned": false,
"is_loanable": false,
"is_depreciation_calculated": false,
"category": {
"name": "IT",
"description": "test-description",
"id": "1699748402743342"
},
"region": {
"name": "test-name",
"id": "1521714521705120"
},
"user": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1498540603148390",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"last_success_audit": {
"description": "test-description",
"id": "2069819757171727",
"time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"status": "test-status"
},
"state_history_comments": "test-state_history_comments",
"last_audit": {
"description": "test-description",
"id": "1569806904581067",
"time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"status": "test-status"
}
}
}
获取资产
此操作帮助您获取资产。
Url
<service domain|custom domain>/app/<portal>/api/v3/assets/{asset_id}
属性
state_history_comments (字符串)
更改资产状态时提供的备注。
serial_number (字符串)
用于识别资产的序列号
acquisition_date (日期)
表示资产的购置日期。
更多属性 全部展开
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/assets/{asset_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/assets/{asset_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/assets/{asset_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/assets/{asset_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"
},
"asset": {
"loan": {
"start_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"id": "2436059452452004",
"returned_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"barcode": "test-barcode",
"due_by_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"loan_id": {
"display_value": "CH 44",
"value": "44"
}
},
"total_cost": 1343434.4333,
"retain_user_site": false,
"type": {
"name": "Asset",
"id": "2018933285562933"
},
"acquisition_date": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"last_updated_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1627526992794249",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"current_cost": 1343434.4333,
"mac_address": "test-mac_address",
"vendor": {
"name": "test-name",
"description": "test-description",
"id": "1508598106138405"
},
"suggested_owner": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "2333210300238087",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"id": "1811130946886149",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"description": "test-description",
"id": "1850985561780658"
},
"department": {
"name": "Administration",
"id": "1596297793459486"
},
"barcode": "test-barcode",
"product_depreciation": {
"useful_life": "1891194435952305",
"id": "1863910267324447",
"depreciation_percent": 1343434.4333,
"salvage_value": 1343434.4333
},
"operational_cost": 1343434.4333,
"asset_tag": "test-asset_tag",
"created_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"is_in_contract": false,
"product": {
"part_no": "test-part_no",
"name": "test-name",
"id": "1538924561770181",
"manufacturer": "test-manufacturer"
},
"asset_depreciation": {
"useful_life": "1514169621635118",
"id": "2155596492095710",
"depreciation_percent": 1343434.4333,
"salvage_value": 1343434.4333
},
"expiry_date": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"used_by_asset": {
"name": "192.0.2.1",
"id": "1615161639482026",
"barcode": "test-barcode"
},
"serial_number": "test-serial_number",
"warranty_expiry": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"ip_address": "test-ip_address",
"created_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1847855233440788",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"site": {
"deleted": false,
"name": "Custom Site",
"id": "2008272288144379"
},
"product_type": {
"image": "test-image",
"name": "Workstation",
"id": "1776127248585271"
},
"last_updated_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"purchase_order": "test-purchase_order",
"name": "192.0.2.1",
"udf_fields": {
"udf_ref1": {
"name": "192.0.2.1",
"id": "2265213289869560"
},
"udf_boolean1": false,
"udf_long1": "1806793859686494",
"udf_date1": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"udf_double1": "test-udf_double1",
"udf_char1": "test-udf_char1",
"deptheadid": {
"name": "192.0.2.1",
"id": "2175045251780693"
}
},
"is_depreciation_configured": false,
"discovered_serial_number": "test-discovered_serial_number",
"location": "test-location",
"is_loaned": false,
"is_loanable": false,
"is_depreciation_calculated": false,
"category": {
"name": "IT",
"description": "test-description",
"id": "1699748402743342"
},
"region": {
"name": "test-name",
"id": "1521714521705120"
},
"user": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1498540603148390",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"last_success_audit": {
"description": "test-description",
"id": "2069819757171727",
"time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"status": "test-status"
},
"state_history_comments": "test-state_history_comments",
"last_audit": {
"description": "test-description",
"id": "1569806904581067",
"time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"status": "test-status"
}
}
}
获取资产列表
此操作帮助您获取资产列表。
Url
<service domain|custom domain>/app/<portal>/api/v3/assets
属性
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/assets\
-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/assets";
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/assets"
$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/assets"
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())
{
"assets": [
{
"loan": {
"start_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"id": "1510894167438614",
"returned_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"barcode": "test-barcode",
"due_by_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"loan_id": {
"display_value": "CH 44",
"value": "44"
}
},
"retain_user_site": false,
"type": {
"name": "Asset",
"id": "2221589639239391"
},
"last_updated_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1767056521034237",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"id": "1535924695172238",
"purchase_cost": 1343434.4333,
"state": {
"name": "In Use",
"description": "test-description",
"id": "1880749423319170"
},
"barcode": "test-barcode",
"created_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"product": {
"part_no": "test-part_no",
"name": "test-name",
"id": "1976861984208771",
"manufacturer": "test-manufacturer"
},
"created_by": {
"email_id": "lincoln@zmail.com",
"is_technician": false,
"sms_mail": "linc123@xys_sms.co",
"phone": "test-phone",
"name": "Lincoln",
"mobile": "test-mobile",
"id": "1621855055856191",
"photo_url": "test-photo_url",
"is_vip_user": false
},
"site": {
"deleted": false,
"name": "Custom Site",
"id": "1812928581155277"
},
"product_type": {
"image": "test-image",
"name": "Workstation",
"id": "1754602739373275"
},
"last_updated_time": {
"display_value": "Nov 10, 2016 11:44 AM",
"value": "1478758440000"
},
"name": "192.0.2.1",
"location": "test-location",
"is_loanable": false,
"category": {
"name": "IT",
"description": "test-description",
"id": "1817089573167815"
},
"state_history_comments": "test-state_history_comments"
}
],
"response_status": [
{
"status_code": 2000,
"status": "success"
}
],
"list_info": {
"has_more_rows": false,
"row_count": 1
}
}
删除资产
此操作帮助您删除资产。
Url
<service domain|custom domain>/app/<portal>/api/v3/assets/{asset_id}
$ curl <service domain|custom domain>/app/<portal>/api/v3/assets/{asset_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/assets/{asset_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/assets/{asset_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/assets/{asset_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"
}
}