-
-
Notifications
You must be signed in to change notification settings - Fork 25
Boards JavaScript
BL edited this page Dec 9, 2017
·
1 revision
export TRELLO_API_KEY=KEY
export TRELLO_OAUTH_TOKEN=TOKEN
Set your Trello Api Key and Trello Auth Token.
var Trello = require('trello-node-api')(TRELLO_API_KEY, TRELLO_OAUTH_TOKEN);
var data = {
name: 'BOARD_NAME', // REQUIRED
defaultLabels: false,
defaultLists: false,
desc: 'Board description.',
idOrganization: 'ORGANIZATION_ID',
idBoardSource: 'BOARD_ID',
keepFromSource: 'none',
powerUps: 'all',
prefs_permissionLevel: 'private',
prefs_voting: 'disabled',
prefs_comments: 'members',
prefs_invitations: 'members',
prefs_selfJoin: true,
prefs_cardCovers: true,
prefs_background: 'blue',
prefs_cardAging: 'regular'
};
Trello.board.create(data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.board.search('BOARD_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.board.searchField('BOARD_ID', 'FIELD_NAME').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.board.searchCards('BOARD_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
var id = 'BOARD_ID'; // REQUIRED
var data = {
name: 'BOARD',
desc: 'Board descriptions',
closed: false,
subscribed: false,
idOrganization: 'ORGANIZATION_ID',
prefs_permissionLevel: 'private',
prefs_selfJoin: true,
prefs_cardCovers: true,
prefs_invitations: 'members',
prefs_voting: 'disabled',
prefs_comments: 'members',
prefs_background: 'blue',
prefs_cardAging: 'regular',
prefs_calendarFeedEnabled: false,
labelNames_green: 'Test Label 1',
labelNames_yellow: 'Test Label 2',
labelNames_orange: 'Test Label 3',
labelNames_red: 'Test Label 4',
labelNames_purple: 'Test Label 5',
labelNames_blue: 'Test Label 6'
};
Trello.board.update(id, data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.board.del('BOARD_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});