Skip to content

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

Organization

Create Organization

    var data = {
        displayName: 'ORGANIZATION_NAME', // REQUIRED
        desc: 'Organization description',
        name: 'NAME',
        website: 'https://example.com'
    };
    Trello.organization.create(data).then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Search Organization

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

Search Field Organization

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

Update Organization

    var id = 'ORGANIZATION_ID'; // REQUIRED
    var data = {
       name: 'or123',
       displayName: 'ORGANIZATION_DISPLAY_NAME',
       desc: 'Organization descriptions',
       website: 'https://example.com',
       prefs_associatedDomain: 'trello.com',
       prefs_externalMembersDisabled: false,
       prefs_googleAppsVersion: 1,
       prefs_boardVisibilityRestrict_org: 'none',
       prefs_boardVisibilityRestrict_private: 'none',
       prefs_boardVisibilityRestrict_public: 'none',
       prefs_orgInviteRestrict: '*.test.com',
       prefs_permissionLevel: 'public'
    };
    Trello.organization.update(id, data).then(function (response) {
        console.log('response ', response);
    }).catch(function (error) {
        console.log('error', error);
    });

Delete Organization

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