-
-
Notifications
You must be signed in to change notification settings - Fork 25
Cards 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: 'CARD_NAME',
desc: 'Card description',
pos: 'top',
idList: 'LIST_ID', //REQUIRED
due: null,
dueComplete: false,
idMembers: ['MEMBER_ID', 'MEMBER_ID', 'MEMBER_ID'],
idLabels: ['LABEL_ID', 'LABEL_ID', 'LABEL_ID'],
urlSource: 'https://example.com',
fileSource: 'file',
idCardSource: 'CARD_ID',
keepFromSource: 'attachments,checklists,comments,due,labels,members,stickers'
};
Trello.card.create(data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.card.search('CARD_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.card.searchField('CARD_ID', 'FIELD_NAME').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
var id = 'CARD_ID'; // REQUIRED
var data = {
name: 'CARD_NAME_TEST',
desc: 'Card description',
closed: false,
idMembers: 'MEMBER_ID,MEMBER_ID,MEMBER_ID',
idAttachmentCover: null,
idList: 'LIST_ID',
idLabels: 'LABEL_ID, LABEL_ID, LABEL_ID',
idBoard: false,
pos: 'top',
due: null,
dueComplete: false,
subscribed: false
};
Trello.card.update(id, data).then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});
Trello.card.del('CARD_ID').then(function (response) {
console.log('response ', response);
}).catch(function (error) {
console.log('error', error);
});