Skip to content

Lists JavaScript

BL edited this page Dec 9, 2017 · 1 revision

Usage

export TRELLO_API_KEY=KEY
export TRELLO_OAUTH_TOKEN=TOKEN

Configuration

Set your Trello Api Key and Trello Auth Token.

var Trello = require('trello-node-api')(TRELLO_API_KEY, TRELLO_OAUTH_TOKEN);

Lists

Create List

    var data = {
         name: 'LIST_NAME', // REQUIRED
         idBoard: 'BOARD_ID', // REQUIRED
         idListSource: 'LIST_ID',
         pos: 'top'
    };
    Trello.list.create(data).then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Search List

    Trello.list.search('LIST_ID').then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Search Field List

    Trello.list.searchField('LIST_ID', 'FIELD_NAME').then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Update List

     var id = 'LIST_ID'; // REQUIRED
     var data = {
         name: 'LIST_NAME',
         closed: false,
         pos: 'top',
         subscribed: false
     }; 
     Trello.list.update(id, data).then(function (response) {
         console.log('response ', response);
     }).catch(function (error) {
         console.log('error', error);
     });