如何在从 addCard trello API 创建 trello 卡后捕获 link?
How to capture link of a trello card after creating it from addCard trello API?
我正在使用 JS 函数在 trello board 中创建一张新卡片
var currentLocation = window.location.href;
function AddCardToTrello() {
Trello.addCard({
url: currentLocation,
name: "{{ soproduct.product }}",
due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }}
});
}
创建后,我得到了一个 Trello 向导,它向我显示了 link 到 Trello 看板上新创建的卡片。我想捕捉这个 link 并将其保存在我的支持 .我该怎么做 ?是否可以从同一个 API 调用中捕获数据?
我刚刚在 Trello 沙盒上测试了这个:
var destinationList = "XX_YOUR_LIST_ID_XX";
var success = function(successMsg) {
asyncOutput(successMsg);
};
var error = function(errorMsg) {
asyncOutput(errorMsg);
};
var newCard =
{name: "I just created a new card!",
desc: "Using the Trello API is fun and easy!",
pos: "top",
due: null,
idList: destinationList
};
Trello.post('/cards/', newCard, success, error);
successMsg
回调值在对象中包含一个参数:
"url": "https://trello.com/c/PCJcEkmm/6-i-just-created-a-new-card"
所以我的建议是将要保存到后端的过程添加到您的成功函数中 - 取决于您使用的 plugin/script 架构。
var success = function(successMsg) {
console.log(successMsg);
//Save to storage here
};
var error = function(errorMsg) {
console.log(errorMsg);
};
function AddCardToTrello() {
Trello.addCard({
url: currentLocation,
name: "{{ soproduct.product }}",
due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }}
}, success, error);
}
我正在使用 JS 函数在 trello board 中创建一张新卡片
var currentLocation = window.location.href;
function AddCardToTrello() {
Trello.addCard({
url: currentLocation,
name: "{{ soproduct.product }}",
due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }}
});
}
创建后,我得到了一个 Trello 向导,它向我显示了 link 到 Trello 看板上新创建的卡片。我想捕捉这个 link 并将其保存在我的支持 .我该怎么做 ?是否可以从同一个 API 调用中捕获数据?
我刚刚在 Trello 沙盒上测试了这个:
var destinationList = "XX_YOUR_LIST_ID_XX";
var success = function(successMsg) {
asyncOutput(successMsg);
};
var error = function(errorMsg) {
asyncOutput(errorMsg);
};
var newCard =
{name: "I just created a new card!",
desc: "Using the Trello API is fun and easy!",
pos: "top",
due: null,
idList: destinationList
};
Trello.post('/cards/', newCard, success, error);
successMsg
回调值在对象中包含一个参数:
"url": "https://trello.com/c/PCJcEkmm/6-i-just-created-a-new-card"
所以我的建议是将要保存到后端的过程添加到您的成功函数中 - 取决于您使用的 plugin/script 架构。
var success = function(successMsg) {
console.log(successMsg);
//Save to storage here
};
var error = function(errorMsg) {
console.log(errorMsg);
};
function AddCardToTrello() {
Trello.addCard({
url: currentLocation,
name: "{{ soproduct.product }}",
due: {{ soproduct.required_date|date:"SHORT_DATE_FORMAT" }}
}, success, error);
}