如何在 python 代码中为趋势 v12 DSM SAAS API 调用传递反恶意软件电子邮件自定义值

How to pass antimalware email customization values for trend v12 DSM SAAS API calls in the python code

抱歉,如果这是一个非常基本的问题,我正在尝试在趋势 v12 DSM SAAS 上设置反恶意软件电子邮件自定义,并正在尝试下面给出的 python 的 API 调用示例。

https://automation.deepsecurity.trendmicro.com/article/dsaas/api-reference?platform=dsaas#operation/listSystemSettings

根据 link,"application/json" 中需要 "Payload"。我尝试在我的 python 源文件夹中创建一个文件夹 "application" 并添加 "settings.json" 具有以下值

{
"anti_malware_setting_event_email_enabled": {"value": "true"}
}

但这似乎不起作用。请指导我如何进行。 我要设置的设置是 antiMalwareSettingEventEmailRecipients 和 antiMalwareSettingEventEmailBodyTemplate 具有以下字段 模板变量:

[COMPUTER]   - The computer on which the malware was detected
[ORIGIN]     - The origin of the scan
[TIME]       - The time at which the malware event was detected
[MALWARE]    - The name of the malware detected
[FILE]       - The infected file
[SCANTYPE]   - The type of scan performed
[RESULT]     - The result of the scan
[REASON]     - The reason for the scan
[VIRUSTYPE]  - The major virus type

这里的问题似乎是在对 /api/systemsettings 进行直接 HTTP 调用时所需的内容与使用 SDK 修改系统设置时所需的内容之间有些混淆。

"application/json" 是要在直接 HTTP 调用上设置的内容类型,然后正文(或负载)将是您 post 编辑的 json 片段。

由于您使用的是 python SDK,因此您无需担心这一点。您可以查看 "python" 选项卡,而不是 API 参考页上的 "payload" 选项卡,它显示了调用的结构大纲,但并不完全完整。

有关 python 代码的详细信息,请参阅这些指南:

我建议您专注于获得一个有效的 python 脚本,其中列出了您感兴趣的设置。这还将告诉您这些设置值的格式。当它有效时,您可以切换到试图修改设置。如果您在此过程中遇到任何问题,请随时 post 提出一个新问题。

P.S。我在 Trend Micro

从事 Deep Security 的研发工作