如果它们没有任何值,如何从板上获取所有 customFieldItems?
How to get all customFieldItems from a board if they don't have any values?
保持简短:
此调用:https://api.trello.com/1/boards/<id>/cards/?fields=all&customFieldItems=true
(因为 key
/token
)
将 return 所有卡片,每个卡片都有 属性 "customFieldItems": []
,但如果卡片自定义字段项具有设置值,则该值仅包含数据。
那么如何获得为特定板配置的所有 customFieldItems?
自定义字段是针对看板定义的,因此您需要查询看板端点,例如:
curl https://api.trello.com/1/boards/${BOARD_ID}/customFields?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}
这将 return 一个 JSON 对象数组,对应于您定义的每个自定义字段(不仅仅是在特定卡片上设置的自定义字段),例如:
[
{
"id": "8c6a9274db4ac31ba3cbd81d",
"idModel": "560bf4298b3dda300c18d09c",
"modelType": "board",
"fieldGroup": "e876ca319520ce6fde0b073213df077664cda39d26385f49cf6e2cbc8ec01801",
"display": {
"cardFront": true
},
"name": "Points",
"pos": 8192,
"options": [
{
"id": "5b6a9274db4ac31ba3cbd821",
"idCustomField": "8c6a9274db4ac31ba3cbd81d",
"value": {
"text": "1"
},
"color": "none",
"pos": 20480
},
{
"id": "5b6a9274db4ac31ba3cbd820",
"idCustomField": "8c6a9274db4ac31ba3cbd81d",
"value": {
"text": "2"
},
"color": "none",
"pos": 36864
},
],
"type": "list"
},
]
参见:https://developers.trello.com/v1.0/reference#boardsidcustomfields
保持简短:
此调用:https://api.trello.com/1/boards/<id>/cards/?fields=all&customFieldItems=true
(因为 key
/token
)
将 return 所有卡片,每个卡片都有 属性 "customFieldItems": []
,但如果卡片自定义字段项具有设置值,则该值仅包含数据。
那么如何获得为特定板配置的所有 customFieldItems?
自定义字段是针对看板定义的,因此您需要查询看板端点,例如:
curl https://api.trello.com/1/boards/${BOARD_ID}/customFields?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}
这将 return 一个 JSON 对象数组,对应于您定义的每个自定义字段(不仅仅是在特定卡片上设置的自定义字段),例如:
[
{
"id": "8c6a9274db4ac31ba3cbd81d",
"idModel": "560bf4298b3dda300c18d09c",
"modelType": "board",
"fieldGroup": "e876ca319520ce6fde0b073213df077664cda39d26385f49cf6e2cbc8ec01801",
"display": {
"cardFront": true
},
"name": "Points",
"pos": 8192,
"options": [
{
"id": "5b6a9274db4ac31ba3cbd821",
"idCustomField": "8c6a9274db4ac31ba3cbd81d",
"value": {
"text": "1"
},
"color": "none",
"pos": 20480
},
{
"id": "5b6a9274db4ac31ba3cbd820",
"idCustomField": "8c6a9274db4ac31ba3cbd81d",
"value": {
"text": "2"
},
"color": "none",
"pos": 36864
},
],
"type": "list"
},
]
参见:https://developers.trello.com/v1.0/reference#boardsidcustomfields