Skip to content

Labels 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);

Labels

Create Labels

    var data = {
        name: 'LABEL_NAME', // REQUIRED
        color: 'orange', // REQUIRED
        idBoard: 'BOARD_ID' // REQUIRED
    };
    Trello.label.create(data).then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Search Label

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

Update Label

    var id = 'LABEL_ID';  // REQUIRED
    var data = {
        name: 'NAME', 
        color: 'orange'
    };
    Trello.label.update(id, data).then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Delete Label

    Trello.label.del('LABEL_ID').then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });