我可以使用TFS Rest API来订阅TFS事件吗?

时间:2016-09-30 12:31:26

标签: tfs

如下面的URL所示,我可以使用它来订阅onprimise TFS事件吗?在TFS 2015或TFS 2016中?

https://www.visualstudio.com/en-us/docs/integrate/get-started/service-hooks/events

1 个答案:

答案 0 :(得分:0)

是。我刚刚测试了使用下面的REST API在TFS 2015.3上创建订阅,并获得了成功的结果:

POST http://tfsserver:8080/tfs/DefaultCollection/_apis/hooks/subscriptions?api-version=1.0
Content-Type: application/json
{
  "publisherId": "tfs",
  "eventType": "build.complete",
  "resourceVersion": "1.0-preview.1",
  "consumerId": "webHooks",
  "consumerActionId": "httpRequest",
  "publisherInputs": {
    "buildStatus": "Failed",
    "definitionName": "MyWebSite CI",
    "projectId": "xxxxxxxxxxxxxxx"
  },
  "consumerInputs": {
    "url": "https://myservice/myhookeventreceiver"
  }
}