Reputation: 2935
Keep things short:
This call: https://api.trello.com/1/boards/<id>/cards/?fields=all&customFieldItems=true
(Of cause with key
/token
)
Will return all cards with each having a property "customFieldItems": []
, but the value only contains data if the cards custom field items has set values.
So how can I get all customFieldItems which are configured for a specific board?
Upvotes: 0
Views: 1012
Reputation: 7483
Custom Fields are defined against the board, so you need to query the Boards endpoint, e.g.:
curl https://api.trello.com/1/boards/${BOARD_ID}/customFields?key=${TRELLO_API_KEY}&token=${TRELLO_TOKEN}
This will return an array of JSON objects that correspond to each Custom Field you have defined (not just the ones that are set on a particular card), e.g.:
[
{
"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"
},
]
See: https://developers.trello.com/v1.0/reference#boardsidcustomfields
Upvotes: 1