通过 REST 调用自定义 DevOps 通知订阅
custom DevOps notification subscription via REST call
我想通过 REST 调用创建 Azure DevOps 通知订阅。收件人邮箱需要传入,不能默认我自己的邮箱。最终目标是以编程方式创建订阅,以便可以自动提醒某些非 ADO 用户有关与他们相关的工作项的解决方案。
谢谢!
custom DevOps notification subscription via REST call
要创建通知订阅,您可以使用此 REST API Subscriptions - Create:
POST https://{service}.dev.azure.com/{organization}/_apis/notification/subscriptions?api-version=6.0
示例请求正文:
{
"description": "A new work item enters our area path",
"filter": {
"eventType": "ms.vss-work.workitem-changed-event",
"criteria": {
"clauses": [],
"groups": [],
"maxGroupLevel": 0
},
"type": "Expression"
},
"subscriber": {
"id": "xxxxxxd71-c2fef2ad085f"
},
"channel": {
"type": "EmailHtml",
"address": "myteam@fabrikam.org",
"useCustomAddress": true
}
}
只需在 "address": "xxxxx"
中设置收件人电子邮件地址即可。
注意:您需要提供eventType and subscriber等。
我的测试结果:
我想通过 REST 调用创建 Azure DevOps 通知订阅。收件人邮箱需要传入,不能默认我自己的邮箱。最终目标是以编程方式创建订阅,以便可以自动提醒某些非 ADO 用户有关与他们相关的工作项的解决方案。
谢谢!
custom DevOps notification subscription via REST call
要创建通知订阅,您可以使用此 REST API Subscriptions - Create:
POST https://{service}.dev.azure.com/{organization}/_apis/notification/subscriptions?api-version=6.0
示例请求正文:
{
"description": "A new work item enters our area path",
"filter": {
"eventType": "ms.vss-work.workitem-changed-event",
"criteria": {
"clauses": [],
"groups": [],
"maxGroupLevel": 0
},
"type": "Expression"
},
"subscriber": {
"id": "xxxxxxd71-c2fef2ad085f"
},
"channel": {
"type": "EmailHtml",
"address": "myteam@fabrikam.org",
"useCustomAddress": true
}
}
只需在 "address": "xxxxx"
中设置收件人电子邮件地址即可。
注意:您需要提供eventType and subscriber等。
我的测试结果: