2

不是 100% 确定我的标题措辞正确,但这就是我想要做的。

我写了一个小页面,主要是 JS 和一个小的 PHP 刮板。该脚本运行,连接到 Trello,根据它找到的内容,它使用 PHP 抓取工具抓取另一个站点,然后更新 Trello 中的一些卡片。

这可以作为我可以在浏览器中加载的页面,但我想将其设置为在我们的服务器上作为 cron 作业运行的页面。我不知道如何修改我的脚本以自动登录到 Trello。我知道我可以运行一次,授权 30 天等,但理想情况下我不想继续这样做。我对此有点不熟悉,所以欢迎任何关于如何最好地接近它的reco。

**从 webapps 移动

4

1 回答 1

2

生成一个不会过期的 API 令牌可能是最简单的,而不是尝试模拟登录到 Trello。

首先,在

https://trello.com/1/appKey/generate

然后,在

https://trello.com/1/authorize?key= replacewithyourapplicationkey &name=My+Application&expiration= never &response_type=token&scope=read,write

这应该足以做 board 和 card GETs 和PUTs,而且你不必担心获得新的令牌,因为它永远不会过期。

例如,您可以阅读一块板:

GET https://api.trello.com/1/boards/id_of_board?key=substitutewithyourapplicationkey&token=substitutewithyournonexpiringtoken

或修改卡片

PUT https://api.trello.com/1/cards/id_of_card?desc=New%20Description&key=substitutewithyourapplicationkey&token=substitutewithyournonexpiringtoken

有关更多详细信息,请参阅https://trello.com/docshttps://trello.com/api

于 2012-02-06T18:39:11.497 回答