Read Trello Cards
Updated: Nov 10, 2023
This example shows you how to read the cards on a Trello board using DataPipeline.
For this example you will need TRELLO_API_KEY
, TRELLO_API_TOKEN
and TRELLO_BOARD_ID
. For information on how to obtain this credentials visit Trello.
Java Code Listing
package com.northconcepts.datapipeline.examples.trello; import com.northconcepts.datapipeline.core.DataReader; import com.northconcepts.datapipeline.core.DataWriter; import com.northconcepts.datapipeline.core.StreamWriter; import com.northconcepts.datapipeline.job.Job; import com.northconcepts.datapipeline.trello.CardFilter; import com.northconcepts.datapipeline.trello.TrelloBoardCardsReader; public class ReadTrelloCards { private static final String TRELLO_API_KEY = "API_KEY"; private static final String TRELLO_API_TOKEN = "API_TOKEN"; private static final String TRELLO_BOARD_ID= "BOARD_ID"; public static void main(String[] args) { DataReader reader = new TrelloBoardCardsReader(TRELLO_API_KEY, TRELLO_API_TOKEN, TRELLO_BOARD_ID) .setCardFilter(CardFilter.CLOSED) ; DataWriter writer = StreamWriter.newSystemOutWriter(); Job.run(reader, writer); } }
Code Walkthrough
- An instance of TrelloBoardCardsReader which takes
TRELLO_API_KEY
,TRELLO_API_TOKEN
andTRELLO_BOARD_ID
as arguments is created. This will be used to read a list of Trello cards belonging to the specified board. .setCardFilter(CardFilter.CLOSED)
is used to filter the type of card that you need. The options areALL
,CLOSED
,NONE
,OPEN
andVISIBLE
.StreamWriter.newSystemOutWriter()
is used to write the output record to the console.- Job.run() is then used to transfer data from the
reader
to StreamWriter.