Guy*_*Guy 3 webhooks node.js trello
我已经使用 Trello 的 API(Node JS 包)添加了 webhooks 。如何获取当前的 webhook 或如何获取现有的 webhook ID?
无法通过 API 找到方法:https : //developers.trello.com/advanced-reference/webhook
这里说:
有三种方法可以删除 webhook。
- 在 webhooks 上使用 DELETE 路由 DELETE https://api.trello.com/1/webhooks/[WEBHOOK_ID]?key=[APPLICATION_KEY]&token=[USER_TOKEN]
- 如果来自 Trello 的 webhook 请求在 POST 到 callbackURL 时收到 HTTP 410 Gone 响应,则 webhook 将被删除。
- 如果 webhook 绑定的 token 被撤销或过期,那么 webhook 将被删除
第一种方法需要 ID,第二种方法需要我每次要删除 webhook 时都关闭服务器,第三种方法也不好。知道如何获取 ID 吗?
小智 8
这是获取应用程序创建的所有 webhook 的 API 请求:
GET https://api.trello.com/1/members/me/tokens?webhooks=true&key=[APPLICATION_KEY]&token=[USER_TOKEN]
Run Code Online (Sandbox Code Playgroud)
下面列出了Trello API 文档 /1/members/[id]/tokens 的相关部分:
GET /1/members/[idMember or username]/tokenslink 所需权限:读取、拥有、帐户
参数
filter(可选的)
- 默认:
all- 有效值:以下之一:
all,nonewebhooks(可选的)
- 默认:
false- 有效值:以下之一:
true,false
另外,请注意,我被用作idMember 或用户名
注意:如果您将我指定为用户名,则此调用的响应就像您提供了与所提供令牌关联的用户名一样
请参阅Trello API 文档 /1/members/me
这是我得到的示例 JSON 响应:
{
"id": "568d40cc3aa021f1b3602ea0",
"identifier": "Server Token",
"idMember": "562d50bc3aa020f1b3602ec0",
"dateCreated": "2016-05-30T22:01:15.721Z",
"dateExpires": null,
"permissions": [
{
"idModel": "562d50bc3aa071f1b3602ec6",
"modelType": "Member",
"read": true,
"write": true
},
{
"idModel": "*",
"modelType": "Board",
"read": true,
"write": true
},
{
"idModel": "*",
"modelType": "Organization",
"read": true,
"write": true
}
],
"webhooks": [
{
"id": "5675a0a8159fbeef4b796da3",
"description": "Feature Requests Board",
"idModel": "55a1176a0b620663da985753",
"callbackURL": "http://example.com/trello/webhook-callback?type=features",
"active": true
},
{
"id": "5673a0ac6ab60af7ec3a706b",
"description": "Bugs Board",
"idModel": "541ebcf34c03910922ff0fc3",
"callbackURL": "http://example.com/trello/webhook-callback?type=bugs",
"active": true
}
}
Run Code Online (Sandbox Code Playgroud)
小智 3
您可以使用令牌资源查看 Webhook 列表。
请参阅此处:https ://developers.trello.com/advanced-reference/token#get-1-tokens-token-webhooks
GET /1/tokens/[令牌]/webhooks
如果您使用相同的令牌创建了 Webhook,则 [token] 等于 [USER_TOKEN]。
| 归档时间: |
|
| 查看次数: |
2115 次 |
| 最近记录: |