<service domain|custom domain>/app/<portal>/api/v3/announcements
公告
公告提醒用户有关服务台相关信息,如服务更新、服务器问题、许可证续订或 UI 发布。在 ServiceDesk Plus Cloud 中,您可以使用公告在公司范围内发布信息,仅对技术人员或特定用户组发布。
属性
user_groups (user_group)
指示可以访问公告的用户组
banner_style (banner_style)
包含启用横幅时的横幅样式
至 (string)
通过电子邮件接收公告的电子邮件地址列表。
created_date (datetime)read only
指示公告的创建日期
comments_count (long)read only
指示公告的评论数量
更多属性 全部展开
添加公告
此操作用于创建新的公告
必填字段:from_date, state, title, description
网址
属性
user_groups (user_group)
指示可以访问公告的用户组
banner_style (banner_style)
包含启用横幅时的横幅样式
至 (string)
通过电子邮件接收公告的电子邮件地址列表。
created_date (datetime)read only
指示公告的创建日期
comments_count (long)read only
指示公告的评论数量
更多属性 全部展开
$ curl <service domain|custom domain>/app/<portal>/api/v3/announcements\
-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='{
"announcement": {
"isbannerenabled": true,
"from_date": {
"value": 1732083706992
},
"show_to_all_technician": false,
"show_to_requester": true,
"announcement_type": {
"id": "100000000000034284"
},
"banner_style": {
"bgcolor": "#4588f0",
"fontcolor": "#001665",
"ispriority_based": false,
"iconname": "warning",
"alignment": "center"
},
"description": "<div class=\"personalize-wrapper\" style=\"font-family: 'PT Sans',Arial,Helvetica,sans-serif, sans-serif;font-size: 13px;\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div>General Announcement - Description [1]<br></div></div><div><br></div></div>",
"priority": {
"id": "100000000000006994"
},
"services": [
{
"id": "100000000000040417"
},
{
"id": "100000000000040419"
}
],
"title": "General Announcement - Title [1]",
"to": [
"abc@test.com",
"def.gh@test.com"
],
"template": {
"id": "100000000000033852"
},
"show_banner_until_expiry": true,
"to_date": {
"value": 1732256460000
},
"user_groups": [
{
"id": "100000000000052003"
},
{
"id": "100000000000052007"
}
],
"technician_groups": [
{
"id": "100000000000041099"
},
{
"id": "100000000000041029"
}
],
"attachments": [
{
"file_id": "3003"
}
]
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/announcements";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"announcement": {
"isbannerenabled": true,
"from_date": {
"value": 1732083706992
},
"show_to_all_technician": false,
"show_to_requester": true,
"announcement_type": {
"id": "100000000000034284"
},
"banner_style": {
"bgcolor": "#4588f0",
"fontcolor": "#001665",
"ispriority_based": false,
"iconname": "warning",
"alignment": "center"
},
"description": "<div class=\"personalize-wrapper\" style=\"font-family: 'PT Sans',Arial,Helvetica,sans-serif, sans-serif;font-size: 13px;\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div>General Announcement - Description [1]<br></div></div><div><br></div></div>",
"priority": {
"id": "100000000000006994"
},
"services": [
{
"id": "100000000000040417"
},
{
"id": "100000000000040419"
}
],
"title": "General Announcement - Title [1]",
"to": [
"abc@test.com",
"def.gh@test.com"
],
"template": {
"id": "100000000000033852"
},
"show_banner_until_expiry": true,
"to_date": {
"value": 1732256460000
},
"user_groups": [
{
"id": "100000000000052003"
},
{
"id": "100000000000052007"
}
],
"technician_groups": [
{
"id": "100000000000041099"
},
{
"id": "100000000000041029"
}
],
"attachments": [
{
"file_id": "3003"
}
]
}
};
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/announcements"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'
{
"announcement": {
"isbannerenabled": true,
"from_date": {
"value": 1732083706992
},
"show_to_all_technician": false,
"show_to_requester": true,
"announcement_type": {
"id": "100000000000034284"
},
"banner_style": {
"bgcolor": "#4588f0",
"fontcolor": "#001665",
"ispriority_based": false,
"iconname": "warning",
"alignment": "center"
},
"description": "<div class=\"personalize-wrapper\" style=\"font-family: 'PT Sans',Arial,Helvetica,sans-serif, sans-serif;font-size: 13px;\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div>General Announcement - Description [1]<br></div></div><div><br></div></div>",
"priority": {
"id": "100000000000006994"
},
"services": [
{
"id": "100000000000040417"
},
{
"id": "100000000000040419"
}
],
"title": "General Announcement - Title [1]",
"to": [
"abc@test.com",
"def.gh@test.com"
],
"template": {
"id": "100000000000033852"
},
"show_banner_until_expiry": true,
"to_date": {
"value": 1732256460000
},
"user_groups": [
{
"id": "100000000000052003"
},
{
"id": "100000000000052007"
}
],
"technician_groups": [
{
"id": "100000000000041099"
},
{
"id": "100000000000041029"
}
],
"attachments": [
{
"file_id": "3003"
}
]
}
}
'@
$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/announcements"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"announcement": {
"isbannerenabled": true,
"from_date": {
"value": 1732083706992
},
"show_to_all_technician": false,
"show_to_requester": true,
"announcement_type": {
"id": "100000000000034284"
},
"banner_style": {
"bgcolor": "#4588f0",
"fontcolor": "#001665",
"ispriority_based": false,
"iconname": "warning",
"alignment": "center"
},
"description": "<div class=\"personalize-wrapper\" style=\"font-family: 'PT Sans',Arial,Helvetica,sans-serif, sans-serif;font-size: 13px;\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div>General Announcement - Description [1]<br></div></div><div><br></div></div>",
"priority": {
"id": "100000000000006994"
},
"services": [
{
"id": "100000000000040417"
},
{
"id": "100000000000040419"
}
],
"title": "General Announcement - Title [1]",
"to": [
"abc@test.com",
"def.gh@test.com"
],
"template": {
"id": "100000000000033852"
},
"show_banner_until_expiry": true,
"to_date": {
"value": 1732256460000
},
"user_groups": [
{
"id": "100000000000052003"
},
{
"id": "100000000000052007"
}
],
"technician_groups": [
{
"id": "100000000000041099"
},
{
"id": "100000000000041029"
}
],
"attachments": [
{
"file_id": "3003"
}
]
}
}'''
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"
},
"announcement": {
"template": {
"inactive": false,
"name": "General Announcement Template",
"id": "100000000000033852"
},
"attachments": [
{
"size": "361693",
"content_type": "image/png",
"file_id": "3003",
"name": "SampleImage.png",
"content_url": "/announcements/100000000000052059/_uploads/3003",
"id": "100000000000052069"
}
],
"has_user_group": true,
"show_to_requester": true,
"show_to_all_technician": false,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div>General Announcement - Description [1]<br></div></div><div><br></div></div>",
"has_technician_group": true,
"title": "General Announcement - Title [1]",
"access_level": "SHARED",
"last_updated_by": null,
"to_date": {
"display_value": "Nov 22, 2024 11:51 AM",
"value": "1732256460000"
},
"rel": {
"initiated_by_change": null,
"initiated_by_release": null,
"initiated_by_problem": null,
"initiated_by_arc_request": null,
"initiated_by_request": null
},
"last_updated_on": null,
"id": "100000000000052059",
"announcement_type": {
"name": "New Service Launched",
"id": "100000000000034284"
},
"views_count": "0",
"state": "ACTIVE",
"technician_groups": [
{
"site": {
"id": "100000000000006792"
},
"deleted": false,
"name": "Data Management",
"id": "100000000000041029"
},
{
"site": {
"id": "100000000000006792"
},
"deleted": false,
"name": "App Development",
"id": "100000000000041099"
}
],
"from_date": {
"display_value": "Nov 20, 2024 11:51 AM",
"value": "1732083706992"
},
"show_banner_until_expiry": true,
"module": null,
"is_followed": false,
"isbannerenabled": true,
"services": [
{
"image": "emp-onboarding",
"inactive": false,
"name": "Employee Onboarding",
"description": "Requests related to new employee onboarding",
"id": "100000000000040417",
"sort_index": 0
},
{
"image": "fin-management",
"inactive": false,
"name": "Feature Request",
"description": "Requests related to new features or improvements",
"id": "100000000000040419",
"sort_index": 0
}
],
"priority": {
"color": "#ff0000",
"name": "High",
"id": "100000000000006994"
},
"created_by": {
"email_id": "admin@test.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.csez.zohocorpin.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Admin",
"job_title": null
},
"deleted": false,
"comments_count": "0",
"created_date": {
"display_value": "Nov 20, 2024 12:00 PM",
"value": "1732084223469"
},
"to": [
"abc@test.com",
"def.gh@test.com"
],
"banner_style": {
"bgcolor": "#4588f0",
"fontcolor": "#001665",
"ispriority_based": false,
"iconname": "warning",
"alignment": "center"
},
"user_groups": [
{
"name": "UG - 1",
"id": "100000000000052003"
},
{
"name": "UG - 2",
"id": "100000000000052007"
}
]
}
}
编辑公告
此操作用于编辑公告。必填字段:公告 ID
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}
属性
user_groups (user_group)
指示可以访问公告的用户组
banner_style (banner_style)
包含启用横幅时的横幅样式
至 (string)
通过电子邮件接收公告的电子邮件地址列表。
created_date (datetime)read only
指示公告的创建日期
comments_count (long)read only
指示公告的评论数量
更多属性 全部展开
$ curl <service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_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='{
"announcement": {
"send_mail": true,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div><b>General Announcement</b> - <i>Description</i> >> 1<br></div></div><div><br></div></div>",
"to_date": null,
"to": [
"def.gh@test.com"
],
"technician_groups": [],
"banner_style": {
"bgcolor": "#6dc5fa",
"fontcolor": "#000000",
"ispriority_based": false,
"iconname": "emergency",
"alignment": "left"
},
"attachments": [
{
"id": "100000000000052069",
"file_id": "3003"
},
{
"file_id": "3005"
}
],
"title": "General Announcement - Title >> 1",
"show_to_requester": true
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"announcement": {
"send_mail": true,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div><b>General Announcement</b> - <i>Description</i> >> 1<br></div></div><div><br></div></div>",
"to_date": null,
"to": [
"def.gh@test.com"
],
"technician_groups": [],
"banner_style": {
"bgcolor": "#6dc5fa",
"fontcolor": "#000000",
"ispriority_based": false,
"iconname": "emergency",
"alignment": "left"
},
"attachments": [
{
"id": "100000000000052069",
"file_id": "3003"
},
{
"file_id": "3005"
}
],
"title": "General Announcement - Title >> 1",
"show_to_requester": 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/announcements/{announcement_id}"
$headers = @{"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
$input_data = @'
{
"announcement": {
"send_mail": true,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div><b>General Announcement</b> - <i>Description</i> >> 1<br></div></div><div><br></div></div>",
"to_date": null,
"to": [
"def.gh@test.com"
],
"technician_groups": [],
"banner_style": {
"bgcolor": "#6dc5fa",
"fontcolor": "#000000",
"ispriority_based": false,
"iconname": "emergency",
"alignment": "left"
},
"attachments": [
{
"id": "100000000000052069",
"file_id": "3003"
},
{
"file_id": "3005"
}
],
"title": "General Announcement - Title >> 1",
"show_to_requester": 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/announcements/{announcement_id}"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"announcement": {
"send_mail": true,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div><b>General Announcement</b> - <i>Description</i> >> 1<br></div></div><div><br></div></div>",
"to_date": null,
"to": [
"def.gh@test.com"
],
"technician_groups": [],
"banner_style": {
"bgcolor": "#6dc5fa",
"fontcolor": "#000000",
"ispriority_based": false,
"iconname": "emergency",
"alignment": "left"
},
"attachments": [
{
"id": "100000000000052069",
"file_id": "3003"
},
{
"file_id": "3005"
}
],
"title": "General Announcement - Title >> 1",
"show_to_requester": 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,
"status": "success"
},
"announcement": {
"template": {
"inactive": false,
"name": "General Announcement Template",
"id": "100000000000033852"
},
"attachments": [
{
"size": "388453",
"content_type": "image/png",
"file_id": "3005",
"name": "SampleImage.png",
"content_url": "/announcements/100000000000052059/_uploads/3005",
"id": "100000000000052083"
},
{
"size": "361693",
"content_type": "image/png",
"file_id": "3003",
"name": "SamplePoster.png",
"content_url": "/announcements/100000000000052059/_uploads/3003",
"id": "100000000000052069"
}
],
"has_user_group": true,
"show_to_requester": true,
"show_to_all_technician": false,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div><b>General Announcement</b> - <i>Description</i> >> 1<br></div></div><div><br></div></div>",
"has_technician_group": false,
"title": "General Announcement - Title >> 1",
"access_level": "SHARED",
"last_updated_by": {
"email_id": "admin@test.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=2451342&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Admin",
"job_title": null
},
"to_date": null,
"rel": {
"initiated_by_change": null,
"initiated_by_release": null,
"initiated_by_problem": null,
"initiated_by_arc_request": null,
"initiated_by_request": null
},
"last_updated_on": {
"display_value": "Nov 20, 2024 01:31 PM",
"value": "1732089698031"
},
"id": "100000000000052059",
"announcement_type": {
"name": "New Service Launched",
"id": "100000000000034284"
},
"views_count": "0",
"state": "ACTIVE",
"technician_groups": [],
"from_date": {
"display_value": "Nov 20, 2024 11:51 AM",
"value": "1732083706992"
},
"show_banner_until_expiry": true,
"module": null,
"is_followed": false,
"isbannerenabled": true,
"services": [
{
"image": "emp-onboarding",
"inactive": false,
"name": "Employee Onboarding",
"description": "Requests related to new employee onboarding",
"id": "100000000000040417",
"sort_index": 0
},
{
"image": "fin-management",
"inactive": false,
"name": "Feature Request",
"description": "Requests related to new features or improvements",
"id": "100000000000040419",
"sort_index": 0
}
],
"priority": {
"color": "#ff0000",
"name": "High",
"id": "100000000000006994"
},
"created_by": {
"email_id": "admin@zohotest.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=156242919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Varadharajan",
"job_title": null
},
"deleted": false,
"comments_count": "0",
"created_date": {
"display_value": "Nov 20, 2024 12:00 PM",
"value": "1732084223469"
},
"to": [
"def.gh@zohotest.com"
],
"banner_style": {
"bgcolor": "#6dc5fa",
"fontcolor": "#000000",
"ispriority_based": false,
"iconname": "emergency",
"alignment": "left"
},
"user_groups": [
{
"name": "UG - 1",
"id": "100000000000052003"
},
{
"name": "UG - 2",
"id": "100000000000052007"
}
]
}
}
获取公告
此操作用于获取单个公告的详细信息。必填字段:公告 ID。添加 input_data 并带有 increment_hit 可增加公告的浏览计数并更新用户的公告查看时间。
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}
属性
user_groups (user_group)
指示可以访问公告的用户组
banner_style (banner_style)
包含启用横幅时的横幅样式
至 (string)
通过电子邮件接收公告的电子邮件地址列表。
created_date (datetime)read only
指示公告的创建日期
comments_count (long)read only
指示公告的评论数量
更多属性 全部展开
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_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/announcements/{announcement_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/announcements/{announcement_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/announcements/{announcement_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"
},
"announcement": {
"template": {
"inactive": false,
"name": "General Announcement Template",
"id": "100000000000033852"
},
"attachments": [
{
"size": "361693",
"content_type": "image/png",
"file_id": "3002",
"name": "SamplePoster.png",
"content_url": "/announcements/100000000000052011/_uploads/3002",
"id": "100000000000052051"
}
],
"has_user_group": true,
"show_to_requester": true,
"show_to_all_technician": false,
"description": "<div class=\"personalize-wrapper\" style=\"font-family:"PT Sans", Arial, Helvetica, sans-serif, sans-serif; font-size:13px\"><div>General Announcement - Description<br></div></div>",
"has_technician_group": true,
"title": "General Announcement - Title",
"access_level": "SHARED",
"last_updated_by": {
"email_id": "admin@test.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Admin",
"job_title": null
},
"to_date": {
"display_value": "Dec 13, 2024 11:15 AM",
"value": "1734068700000"
},
"last_updated_on": {
"display_value": "Nov 20, 2024 11:16 AM",
"value": "1732081587161"
},
"id": "100000000000052011",
"announcement_type": {
"name": "New Service Launched",
"id": "100000000000034284"
},
"views_count": "3",
"state": "ACTIVE",
"technician_groups": [
{
"site": {
"id": "100000000000006792"
},
"deleted": false,
"name": "Data Management",
"id": "100000000000041029"
},
{
"site": {
"id": "100000000000006792"
},
"deleted": false,
"name": "Major Incident Team",
"id": "100000000000041057"
}
],
"from_date": {
"display_value": "Nov 19, 2024 05:49 PM",
"value": "1732018796718"
},
"show_banner_until_expiry": true,
"module": {
"api_plural_name": "problems",
"name": "problem",
"display_name_plural": "sdp.module.pluralname.problem",
"id": "100000000000005097",
"display_name": "Problem",
"category": "SYSTEM",
"icon_name": null
},
"is_followed": false,
"isbannerenabled": true,
"services": [
{
"image": "email-server",
"inactive": false,
"name": "Email",
"description": "Employee email service using Exchange.",
"id": "100000000000008971",
"sort_index": 0
},
{
"image": "corporate-website",
"inactive": false,
"name": "Corporate Website",
"description": "Our external website.",
"id": "100000000000008983",
"sort_index": 0
},
{
"image": "emp-onboarding",
"inactive": false,
"name": "Employee Onboarding",
"description": "Requests related to new employee onboarding",
"id": "100000000000040417",
"sort_index": 0
}
],
"priority": {
"color": "#ff0000",
"name": "High",
"id": "100000000000006994"
},
"rel": {
"initiated_by_problem": {
"problem": {
"display_id": {
"display_value": "PB-4",
"value": "4"
},
"id": "100000000000046364",
"title": "Bugs in AIX production server",
"customer": null
},
"id": "100000000000052073"
}
},
"created_by": {
"email_id": "varadharajan.mt@zohotest.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Varadharajan",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Varadharajan",
"job_title": null
},
"deleted": false,
"comments_count": "0",
"created_date": {
"display_value": "Nov 19, 2024 05:50 PM",
"value": "1732018838556"
},
"to": [
"abc@test.com",
"def+gh@test.com"
],
"banner_style": {
"bgcolor": "#4588f0",
"fontcolor": "#001665",
"ispriority_based": false,
"iconname": "warning",
"alignment": "center"
},
"user_groups": [
{
"name": "UG - 1",
"id": "100000000000052003"
},
{
"name": "UG - 2",
"id": "100000000000052007"
}
]
}
}
获取公告列表
此操作用于获取所有公告的详细信息。
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements
属性
user_groups (user_group)
指示可以访问公告的用户组
banner_style (banner_style)
包含启用横幅时的横幅样式
created_date (datetime)read only
指示公告的创建日期
comments_count (long)read only
指示公告的评论数量
created_by (用户)read only
表示创建公告的技术人员
更多属性 全部展开
$ curl -G <service domain|custom domain>/app/<portal>/api/v3/announcements\
-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='{
"list_info": {
"row_count": 10,
"start_index": 1,
"fields_required": [
"created_by",
"isbannerenabled",
"from_date",
"to_date",
"priority",
"announcement_type",
"views_count",
"is_followed",
"created_date",
"last_updated_by",
"last_updated_on",
"state",
"customer",
"show_to_requester",
"has_user_group",
"show_to_all_technician",
"module",
"title",
"access_level",
"comments_count",
"has_technician_group"
],
"get_total_count": true,
"filter_by": {
"id": "0"
},
"sort_fields": [
{
"field": "from_date",
"order": "desc"
}
]
}
}'
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/announcements";
headers = {"Accept":"application/vnd.manageengine.sdp.v3+json",
"Content-Type": "application/x-www-form-urlencoded",
"Authorization": "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"};
input_data = {
"list_info": {
"row_count": 10,
"start_index": 1,
"fields_required": [
"created_by",
"isbannerenabled",
"from_date",
"to_date",
"priority",
"announcement_type",
"views_count",
"is_followed",
"created_date",
"last_updated_by",
"last_updated_on",
"state",
"customer",
"show_to_requester",
"has_user_group",
"show_to_all_technician",
"module",
"title",
"access_level",
"comments_count",
"has_technician_group"
],
"get_total_count": true,
"filter_by": {
"id": "0"
},
"sort_fields": [
{
"field": "from_date",
"order": "desc"
}
]
}
};
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/announcements"
$headers = @{ "Accept" = "application/vnd.manageengine.sdp.v3+json"
"Authorization" = "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx"
"Content-Type" = "application/x-www-form-urlencoded"}
$input_data = @'{
"list_info": {
"row_count": 10,
"start_index": 1,
"fields_required": [
"created_by",
"isbannerenabled",
"from_date",
"to_date",
"priority",
"announcement_type",
"views_count",
"is_followed",
"created_date",
"last_updated_by",
"last_updated_on",
"state",
"customer",
"show_to_requester",
"has_user_group",
"show_to_all_technician",
"module",
"title",
"access_level",
"comments_count",
"has_technician_group"
],
"get_total_count": true,
"filter_by": {
"id": "0"
},
"sort_fields": [
{
"field": "from_date",
"order": "desc"
}
]
}
}'@
$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/announcements"
headers ={"Accept": "application/vnd.manageengine.sdp.v3+json",
"Authorization" : "Zoho-oauthtoken 1000.7xxx98976ab0xxxxxx19901e7551be57.bxxxx921ed64c04f79622bebcfxxxxxx",
"Content-Type" : "application/x-www-form-urlencoded"}
input_data = '''{
"list_info": {
"row_count": 10,
"start_index": 1,
"fields_required": [
"created_by",
"isbannerenabled",
"from_date",
"to_date",
"priority",
"announcement_type",
"views_count",
"is_followed",
"created_date",
"last_updated_by",
"last_updated_on",
"state",
"customer",
"show_to_requester",
"has_user_group",
"show_to_all_technician",
"module",
"title",
"access_level",
"comments_count",
"has_technician_group"
],
"get_total_count": true,
"filter_by": {
"id": "0"
},
"sort_fields": [
{
"field": "from_date",
"order": "desc"
}
]
}
}'''
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": {
"sort_fields": [
{
"field": "from_date",
"order": "desc"
}
],
"has_more_rows": false,
"start_index": 1,
"fields_required": [
"created_by",
"isbannerenabled",
"from_date",
"to_date",
"priority",
"announcement_type",
"views_count",
"is_followed",
"created_date",
"last_updated_by",
"last_updated_on",
"state",
"customer",
"show_to_requester",
"has_user_group",
"show_to_all_technician",
"module",
"title",
"access_level",
"comments_count",
"has_technician_group"
],
"total_count": 3,
"filter_by": "{\"id\":\"0\"}",
"page": 1,
"get_total_count": "true",
"row_count": 3
},
"announcements": [
{
"has_user_group": true,
"from_date": {
"display_value": "Nov 20, 2024 11:51 AM",
"value": "1732083706992"
},
"module": null,
"is_followed": false,
"show_to_requester": true,
"show_to_all_technician": false,
"has_technician_group": false,
"isbannerenabled": true,
"priority": {
"color": "#ff0000",
"name": "High",
"id": "100000000000006994"
},
"title": "General Announcement - Title >> 1",
"created_by": {
"email_id": "admin@test.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Admin",
"job_title": null
},
"access_level": "SHARED",
"last_updated_by": {
"email_id": "admin@test.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Admin",
"job_title": null
},
"to_date": null,
"comments_count": "0",
"last_updated_on": {
"display_value": "Nov 20, 2024 01:31 PM",
"value": "1732089698031"
},
"id": "100000000000052059",
"announcement_type": {
"name": "New Service Launched",
"id": "100000000000034284"
},
"views_count": "0",
"created_date": {
"display_value": "Nov 20, 2024 12:00 PM",
"value": "1732084223469"
},
"state": "ACTIVE"
},
{
"has_user_group": true,
"from_date": {
"display_value": "Nov 19, 2024 05:49 PM",
"value": "1732018796718"
},
"module": null,
"is_followed": false,
"show_to_requester": true,
"show_to_all_technician": false,
"has_technician_group": true,
"isbannerenabled": true,
"priority": {
"color": "#ff0000",
"name": "High",
"id": "100000000000006994"
},
"title": "General Announcement - Title >> 2",
"created_by": {
"email_id": "admin2@zohotest.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "admin2",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "admin2",
"job_title": null
},
"access_level": "SHARED",
"last_updated_by": {
"email_id": "admin@test.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "Admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "Admin",
"job_title": null
},
"to_date": {
"display_value": "Dec 13, 2024 11:15 AM",
"value": "1734068700000"
},
"comments_count": "0",
"last_updated_on": {
"display_value": "Nov 20, 2024 01:37 PM",
"value": "1732090042419"
},
"id": "100000000000052011",
"announcement_type": {
"name": "New Service Launched",
"id": "100000000000034284"
},
"views_count": "3",
"created_date": {
"display_value": "Nov 19, 2024 05:50 PM",
"value": "1732018838556"
},
"state": "ACTIVE"
},
{
"has_user_group": false,
"from_date": {
"display_value": "Nov 17, 2024 09:39 PM",
"value": "1731859747561"
},
"module": {
"api_plural_name": "requests",
"name": "request",
"display_name_plural": "sdp.module.pluralname.request",
"id": "100000000000005074",
"display_name": "Request",
"category": "SYSTEM",
"icon_name": null
},
"is_followed": false,
"show_to_requester": false,
"show_to_all_technician": false,
"has_technician_group": true,
"isbannerenabled": true,
"priority": null,
"title": "Announcement Template 1 - Title",
"created_by": {
"email_id": "admin2.mt@zohotest.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "admin2",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "admin2",
"job_title": null
},
"access_level": "SHARED",
"last_updated_by": {
"email_id": "admin2.mt@zohotest.com",
"is_technician": true,
"sms_mail": null,
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true
},
"phone": null,
"employee_id": null,
"name": "admin2",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "admin2",
"job_title": null
},
"to_date": null,
"comments_count": "0",
"last_updated_on": {
"display_value": "Nov 20, 2024 01:38 PM",
"value": "1732090081603"
},
"id": "100000000000050316",
"announcement_type": null,
"views_count": "1",
"created_date": {
"display_value": "Nov 17, 2024 09:39 PM",
"value": "1731859752475"
},
"state": "ACTIVE"
}
]
}
删除公告
此操作用于删除公告。
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}
$ curl <service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_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/announcements/{announcement_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/announcements/{announcement_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/announcements/{announcement_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"
}
}
关注公告
此操作用于关注特定公告
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/follows/_follow
$ curl <service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/follows/_follow\
-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=''
// Deluge Sample script
url = "<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/follows/_follow";
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: POST
parameters: params
headers: headers
];
info response;
#Powershell version - 5.1
$url = "<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/follows/_follow"
$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 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/announcements/{announcement_id}/follows/_follow"
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="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"
},
"follow": {
"follower": {
"email_id": "admin.mt@test.com",
"is_technician": true,
"sms_mail": null,
"contact_info_id": "100000000000040115",
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true,
"customer": null
},
"phone": null,
"employee_id": null,
"name": "admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "admin",
"job_title": null,
"customer": null
},
"performed_by": {
"email_id": "admin.mt@test.com",
"is_technician": true,
"sms_mail": null,
"contact_info_id": "100000000000040115",
"mobile": null,
"last_name": "M",
"user_scope": "internal_user",
"sms_mail_id": null,
"cost_per_hour": "0",
"site": {
"deleted": false,
"name": "Base Site",
"id": "100000000000006792",
"is_default": true,
"customer": null
},
"phone": null,
"employee_id": null,
"name": "admin",
"id": "100000000000040117",
"photo_url": "https://contacts.zoho.com/file?exp=10&ID=15646919&t=user&height=60&width=60",
"is_vip_user": false,
"department": null,
"first_name": "admin",
"job_title": null,
"customer": null
},
"module": {
"api_plural_name": "announcements",
"name": "announcement",
"display_name_plural": "sdp.home.announcement.label",
"id": "100000000000005134",
"display_name": "Announcement",
"category": "SYSTEM",
"icon_name": null
},
"followed_time": {
"display_value": "Nov 20, 2024 01:46 PM",
"value": "1732090566577"
},
"id": "100000000000052133",
"entity_id": "100000000000052059"
}
}
取消关注公告
此操作用于取消关注特定公告
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/follows/_unfollow
$ curl <service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/follows/_unfollow\
-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/announcements/{announcement_id}/follows/_unfollow";
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/announcements/{announcement_id}/follows/_unfollow"
$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/announcements/{announcement_id}/follows/_unfollow"
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"
}
}
向公告添加附件
此操作用于为公告添加附件。输入必须为 multipart - form 数据。必填字段:filename
必填字段:filename
网址
<service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_id}/_uploads
属性
$ curl <service domain|custom domain>/app/<portal>/api/v3/announcements/{announcement_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/announcements/{announcement_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/announcements/{announcement_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/announcements/{announcement_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/png",
"size": "388453",
"file_id": "3005",
"name": "testPoster.png",
"content_url": "/announcements/_uploads/3005"
}
]
}