每个人,
我一直在通过API自动创建 Visual Studio Team Services - Service Hook Subscriptions 。我可以让TFS发布者工作,但不能让RM发布者工作。我正在尝试为发布部署已完成创建一个钩子订阅。即使与我的数据交换,我发现的任何示例都不起作用。 TFS 提供商的工作非常完美。回复样本......
POST https://project.visualstudio.com/_apis/hooks/subscriptions?api-version=4.1-preview
体:
{
"publisherId": "rm",
"eventType": "ms.vss-release.deployment-completed-event",
"consumerId": "slack",
"consumerActionId": "postMessageToChannel",
"publisherInputs": {
"releaseEnvironmentId" : "777",
"releaseDefinitionId" : "1",
"releaseEnvironmentStatus" : "4",
"projectId" : "6ce954b1-ce1f-45d1-b94d-e6bf2464ba2c"
},
"consumerInputs": {
"url": "https://hooks.slack.com/services/myservice/crazyGuidxxxxxxxxxxxxxxxx"
}
}
响应:
{
"$id": "1",
"innerException": null,
"message": "There is no registered handler for the service hooks event type ms.vss-release.deployment-completed-event.",
"typeName": "System.InvalidOperationException, mscorlib",
"typeKey": "InvalidOperationException",
"errorCode": 0,
"eventId": 0
}
答案 0 :(得分:0)
这是因为你在网址中错过了 vsrm 的版本。使用以下api,您将获得成功的回复:
POST https://project.vsrm.visualstudio.com/_apis/hooks/subscriptions?api-version=4.1-preview