首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法通过REST API为punlisherId = tfs和eventId tfvc.checkin创建VSTS webhook订阅

无法通过REST API为punlisherId = tfs和eventId tfvc.checkin创建VSTS webhook订阅
EN

Stack Overflow用户
提问于 2018-03-05 17:38:19
回答 1查看 287关注 0票数 0

我正在尝试为publisherId= tfs和eventType= tfvc.checkin创建一个VSTS webhook订阅。以下是Post请求示例:

网址:https://testvstsaccount.visualstudio.com/_apis/hooks/subscriptions?api-version=1.0

请求正文:

代码语言:javascript
运行
复制
{
  "publisherId": "tfs",
  "eventType": "tfvc.checkin",
  "resourceVersion": "1.0-preview.1",
  "consumerId": "webHooks",
  "consumerActionId": "httpRequest",
  "publisherInputs": {
    "path": "$/"
  },
  "consumerInputs": {
    "url": "https://myservice/myhookeventreceiver"
  }
}

我收到了400个错误的请求作为响应。

响应正文:

代码语言:javascript
运行
复制
{
  "$id": "1",
  "innerException": null,
  "message": "Subscription input 'path' is not supported at scope 'collection'.",
  "typeName": "Microsoft.VisualStudio.Services.ServiceHooks.WebApi.SubscriptionInputException, Microsoft.VisualStudio.Services.ServiceHooks.WebApi, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
  "typeKey": "SubscriptionInputException",
  "errorCode": 0,
  "eventId": 4501
}

谁能帮助我理解正确的方法来创建这个网络挂钩。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-03-06 11:11:19

path正在筛选更改指定路径下的一个或多个文件的签入。它应该看起来像$/TeamProject$/TeamProject/Project$/TeamProject/Project/...。不支持$/。下面是我的例子:

代码语言:javascript
运行
复制
POST https://xxx.visualstudio.com/DefaultCollection/_apis/hooks/subscriptions?api-version=1.0

Content-Type: application/json

{
  "consumerActionId": "httpRequest",
  "consumerId": "webHooks",
  "consumerInputs": { "url": "https://xxx.visualstudio.com" },
  "eventType": "tfvc.checkin",
  "publisherId": "tfs",
  "publisherInputs": {
    "path": "$/TestCase/TestCaseProject",
    "projectId": "1decf66b-1974-43e3-xxxx-ba9a3fd2xxxx"
  },
  "resourceVersion": "1.0",
  "scope": 1
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/49107284

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档