尝试创建 VSTS API 服务挂钩订阅时出错
Error when attempting to create VSTS API Service Hook Subscription
各位,
我一直在四处寻找如何通过 API 自动创建 Visual Studio 团队服务 - 服务挂钩订阅。我可以让 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
}
这是因为您在 url 中错过了 vsrm 的发布。使用以下 api,您将获得成功的响应:
POST https://project.vsrm.visualstudio.com/_apis/hooks/subscriptions?api-version=4.1-preview
各位,
我一直在四处寻找如何通过 API 自动创建 Visual Studio 团队服务 - 服务挂钩订阅。我可以让 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
}
这是因为您在 url 中错过了 vsrm 的发布。使用以下 api,您将获得成功的响应:
POST https://project.vsrm.visualstudio.com/_apis/hooks/subscriptions?api-version=4.1-preview