【问题标题】:How to add unique integer short ID (feature number) for every card in trello?如何为 trello 中的每张卡添加唯一的整数短 ID(功能编号)?
【发布时间】:2015-07-13 08:49:12
【问题描述】:

我编写了一个网络脚本,它为trello card ID 生成特征编号并将其保存在数据库中。

我还创建了一个 webhook,它在 trello board 更改时执行

当我创建卡片时,webhook 向 callbackURL 发送请求,但该请求不包含有关事件的数据。它仅包含模型信息(关于板)。如何获取新卡的 ID?

{
    "model"=>{
        "id"=>"5204523d8d3432ff1a000a60",
        "name"=>"#BOARD",
        "desc"=>"",
        "descData"=>nil,
        "closed"=>false,
        "idOrganization"=>"53aaf6e5309dc12a75111fbf",
        "pinned"=>false,
        "url"=>"https://trello.com/b/ABdAaJeO/board",
        "shortUrl"=>"https://trello.com/b/ABdAaJeO",
        "prefs"=>{
            "permissionLevel"=>"org",
            "voting"=>"disabled",
            "comments"=>"members",
            "invitations"=>"members",
            "selfJoin"=>false,
            "cardCovers"=>true,
            "calendarFeedEnabled"=>true,
            "background"=>"river",
            "backgroundColor"=>nil,
            "backgroundImage"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/full.jpg",
            "backgroundImageScaled"=>[
                {
                    "width"=>2400,
                    "height"=>1600,
                    "url"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/large.jpg"
                },
                {
                    "width"=>1024,
                    "height"=>683,
                    "url"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/medium.jpg"
                },
                {
                    "width"=>320,
                    "height"=>213,
                    "url"=>"https://d2a2fgsv6pobq6.cloudfront.net/images/backgrounds/river/small.jpg"
                }
            ],
            "backgroundTile"=>false,
            "backgroundBrightness"=>"dark",
            "canBePublic"=>true,
            "canBeOrg"=>true,
            "canBePrivate"=>true,
            "canInvite"=>true
        },
        "labelNames"=>{
            "green"=>"",
            "yellow"=>"Тесты",
            "orange"=>"frontend",
            "red"=>"bugs",
            "purple"=>"инфраструктура",
            "blue"=>"backend",
            "sky"=>"проектирование",
            "lime"=>"гипотеза",
            "pink"=>"",
            "black"=>""
        }
    },
    "feature"=>{

    }
}

附: 我们使用 Scrum,现在使用 Trello。对于每个功能,我们都会在 trello 中创建一张卡片。我们创建带有前缀的 git 分支,包含功能编号(f231_feature 等)。当我推送更改时,我想自动向 trello 卡添加评论。

我们为每个功能使用整数,但 trello 卡 ID 太长,我们无法使用它。 Trello 卡有整数代码(例如 URL https://trello.com/c/2zrZE33/231-trello 中的 231),但这些代码在一个板上是唯一的,它不适合我们,因为我们将完成的卡移动到其他板上。

【问题讨论】:

    标签: git webhooks trello


    【解决方案1】:

    我收到了 Trello 团队的答复:

    如果您的 webhook 设置为以 model 观看板,那么您应该在 webhook POST 上收到以下信息:

     "card": {
                    "shortLink": "wKiG3zv8",
                    "idShort": 42,
                    "name": "I'm a new card",
                    "id": "55478b893a73ba2e400381c6"
                }
    

    在这种情况下,shortLink 选项是为 Trello 保存功能编号的最佳方式 — 通过转到 shortLink 的 https://www.trello.com/c/[the 值],您可以取出卡片。或者,您可以使用该 POST 中也提供的卡的完整“ID”。任一选项都可用作 Trello 中卡片的唯一标识符。

    该信息包含在“数据”数组中,而不是“模型”数组中。有关已采取的行动的信息,这将是最好的查看位置。

    我检查了我的脚本并发现了错误。 Trello webhook POST 请求实际上不仅发送model 对象,还发送action 信息,包括有关新卡的信息。

    【讨论】:

    • 作为一个有点相关的问题,请参阅 this answer 了解您应该为每个 webhook 接收哪些数据。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-02
    • 2022-11-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多