我正在编写一个道电,但由于 API 功能有限,我在道具中使用了 Trello 客户端 API。到目前为止一切正常,但我无法将清单项目状态更改为"完成"。
我还没有找到特定的 API!
所以我尝试创建一个新的 cheklist 项目,然后删除不完整的 cheklist 项目。
function completeCicle(cod_cicle){
// there is no API to "complete" a checkitem. So i made two steps:
// 1 - copy the checkitem content to a new checkitem
// 2 - delete the uncomplete checkitem
var CI = getCheckItemCicle(cod_cicle); // get the in-memory unchecked checkitem object
Trello.post("/checklists/"+CI.idChecklist+"/checkItems",{name:CI.name, pos:String(CI.pos+1), checked:"true"}); // this works
Trello.delete("/checklists/"+CI.idChecklist+"/checkItems/"+CI.id,{idCheckItem:CI.id}, t_error); // this did not works
}
但。。。删除似乎没有任何效果,也没有引发任何错误。知道吗?
用于更改检查项状态的 API 路由位于卡路由下。
有关完整文档,您可以在此处查看 Trello 开发人员网站:https://developers.trello.com/advanced-reference/card#put-1-cards-card-id-or-shortlink-checklist-idchecklist-checkitem-idcheckitem-state
但是,简短的版本是您可以做的
PUT /1/cards/[card id or shortlink]/checklist/[idChecklist]/checkItem/[idCheckItem]/state
该端点的参数value=
complete, false, incomplete, true
之一。
因此,例如,要将检查项标记为已完成,您将执行以下操作:
PUT /1/cards/[card id or shortlink]/checklist/[idChecklist]/checkItem/[idCheckItem]/state?value=complete