gpt4 book ai didi

node.js - 在 Trello 上查找现有的 Webhooks ID

转载 作者:搜寻专家 更新时间:2023-11-01 00:17:08 25 4
gpt4 key购买 nike

我使用 Trello 的 API ( Node JS package ) 添加了 webhooks。如何获取当前的 webhook 或如何获取现有的 webhook ID?

找不到通过 API 的方法: https://developers.trello.com/advanced-reference/webhook

Here它说:

There are three ways to delete webhooks.

  1. Using the DELETE route on webhooksDELETE https://api.trello.com/1/webhooks/[WEBHOOK_ID]?key=[APPLICATION_KEY]&token=[USER_TOKEN]
  2. If the webhook request from Trello, when POSTing to the callbackURL, receives an HTTP 410 Gone response, the webhook will be deleted.
  3. If the token that the webhook is bound to is revoked or expires, then the webhook will be deleted

第一种方法需要 ID,第二种方法需要我每次想删除 webhook 时关闭服务器,第三种方法也不是更好。知道如何获取 ID 吗?

最佳答案

这是获取应用程序创建的所有 webhook 的 API 请求:

GET https://api.trello.com/1/members/me/tokens?webhooks=true&key=[APPLICATION_KEY]&token=[USER_TOKEN]

Trello API Documentation /1/members/[id]/tokens的相关部分如下所示:

GET/1/members/[idMember or username]/tokenslink所需权限:阅读、拥有、帐户

Arguments

  • filter (optional)
    • Default: all
    • Valid Values: One of: all, none
  • webhooks (optional)
    • Default: false
    • Valid Values: One of: true, false

另外,请注意 me 用作 idMember 或用户名

Note: If you specify me as the username, this call will respond as if you had supplied the username associated with the supplied token

参见 Trello API documentation /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
}
}

关于node.js - 在 Trello 上查找现有的 Webhooks ID,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37815939/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com