node-jivesbs-rest

0.0.3 • Public • Published

node-jivesbs-rest

REST API and Feed Wrapper for Jive SBS 4.5. This module uses the require module, xml2js and basic auth to communicate with Jive SBS 4.5 and its REST service.

Before using this wrapper, you must enable feeds and the rest API itself in the admin console.

Using node-jivesbs-rest

$ npm install node-jivesbs-rest

With it now installed in your project:

settings =
    user      : "admin"
    pass      : "jive"
    url       : "https://jivesbs.company.com"
    strictSSL : true

JiveContainer = require 'node-jivesbs-rest'

jive = new JiveContainer(settings)

getProjects

is a prototype function of the JiveContainer class. It takes a callback (err, data), where data is the JSON results from Jive.

jive.getProjects (err, json)->
  if err
    console.log err
  else
    console.log json[id].name[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    ID: [ '1' ],
    objectType: [ '600' ],
    uuid: [ '' ],
    version: [ '1' ],
    contentTypesIDs: [ ... ],
    creationDate: [ '2011-05-23T09:46:20.687-05:00' ],
    description: [ 'This is a project' ],
    displayName: [ 'first-project' ],
    modificationDate: [ '2013-08-21T10:52:42.068-05:00' ],
    name: [ 'First  Project' ],
    typeID: [ '0' ],
    userID: [ '2000' ]
  },
  {
    ID: [ '2' ],
    ...
  }
  ...
]

getGroups

is a prototype function of the JiveContainer class. It takes a callback (err, data), where data is the JSON results from Jive.

jive.getGroups (err, json)->
  if err
    console.log err
  else
    console.log json[id].name[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    ID: [ '1' ],
    objectType: [ '700' ],
    uuid: [ '' ],
    version: [ '1' ],
    contentTypesIDs: [ ... ],
    creationDate: [ '2011-05-23T09:46:20.687-05:00' ],
    description: [ 'This is a group' ],
    displayName: [ 'first-group' ],
    modificationDate: [ '2013-08-21T10:52:42.068-05:00' ],
    name: [ 'First Group' ],
    typeID: [ '0' ],
    userID: [ '2000' ]
  },
  {
    ID: [ '2' ],
    ...
  }
  ...
]

getCommunities

is a prototype function of the JiveContainer class. It takes a callback (err, json), where json is the RESTful results from Jive.

jive.getCommunities (err, json)->
  if err
    console.log err
  else
    console.log json[id].name[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    title: [ 'Jive Document.docx' ],
    link: [ 'https://domain.com/docs/DOC-2938' ],
    description: [ 'body text' ],
    category: [ { _: 'glow', '$': [Object] } ],
    pubDate: [ 'Wed, 16 Mar 2011 16:33:52 GMT' ],
    author: [ 'email@domain.com' ],
    guid: [ 'https://domain.com/docs/DOC-2938' ],
    'dc:date': [ '2011-03-16T16:33:52Z' ]
  },
  {
    title: ['Another document.docx'],
    ...
  }
  ...
]

getProjectDocuments

is a prototype function of the JiveContainer class. It takes a projectId string and a callback (err, json), where json is the RESTful results from Jive.

jive.getProjectDocuments '1234', (err, json)->
  if err
    console.log err
  else
    console.log json[id].name[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    title: [ 'Jive Document.docx' ],
    link: [ 'https://domain.com/docs/DOC-2938' ],
    description: [ 'body text' ],
    category: [ { _: 'glow', '$': [Object] } ],
    pubDate: [ 'Wed, 16 Mar 2011 16:33:52 GMT' ],
    author: [ 'email@domain.com' ],
    guid: [ 'https://domain.com/docs/DOC-2938' ],
    'dc:date': [ '2011-03-16T16:33:52Z' ]
  {
    title: ['Another project Document.pptx'],
    ...
  },
  ...
]

getCommunityDocuments

is a prototype function of the JiveContainer class. It takes a communityId string and a callback (err, json), where json is the RESTful results from Jive.

jive.getCommunityDocuments '1234', (err, json)->
  if err
    console.log err
  else
    console.log json[id].name[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    ID: [ '1207' ],
    objectType: [ '102' ],
    version: [ '1' ],
    body: [ '...' ],
    commentStatus: [ '2' ],
    containerID: [ '2222' ],
    containerType: [ '14' ],
    creationDate: [ '2010-12-06T06:08:38.401-06:00' ],
    documentID: [ 'DOC-1207' ],
    ...,
    language: [ 'en' ],
    modificationDate: [ '2010-12-06T06:13:12.523-06:00' ],
    subject: [ 'Document Subject Line' ],
    textBody: [ 'true' ],
    viewCount: [ '24' ]
  },
  {
    subject: ['Another community Document'],
    ...
  }
  ...
]

getAttachments

is a prototype function of the JiveContainer class. It takes a document ID string and a callback (err, json), where json is the RESTful results from Jive. json[x].data[0] will always contain the binary data for an existing attachment. json will be an empty set if there are no attachments for the given document Id.

jive.getAttachments '1234', (err, json)->
  if err
    console.log err
  else
    console.log json[id] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    ID: [ '4274' ],
    objectType: [ '13' ],
    uuid: [ '' ],
    version: [ '1' ],
    contentType: [ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' ],
    data: [ [ 'BINARY' ] ],
    name: [ 'Attachment.docx' ]
  },
  {
    name: ['Another attachment.docx'],
    ...
  }
  ...
]

getBinaryDocuments

is a prototype function of the JiveContainer class. It takes a document ID string and a callback (err, binaryDocument), where binaryDocument is the RESTful result from Jive.
binaryDocument.data[0] will contain the binary data for a document, if one exists.

jive.getBinaryDocument '1234', (err, binaryDocument)->
  if err
    console.log err
  else
    console.log binaryDocument.data[0]

The data returned looks something like this.

{
  ID: [ '11564' ],
  objectType: [ '110' ],
  uuid: [ '' ],
  version: [ '1' ],
  contentType: [ 'application/pdf' ],
  data: [ 'BINARY' ],
  downloadCount: [ '0' ],
  name: [ 'Document.pdf' ],
  size: [ '85315' ]
}

getGroupDocuments

is a prototype function of the JiveContainer class. It takes a groupId string and a callback (err, json), where json is the RESTful results from Jive.

jive.getGroupDocuments '1234', (err, json)->
  if err
    console.log err
  else
    console.log json[id].title[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    title: [ 'A Group Document' ],
    link: [ 'https://jive.server.com/docs/DOC-1624' ],
    description: [ '...' ],
    category: [ ... ],
    ...,
    pubDate: [ 'Wed, 22 Dec 2010 15:22:36 GMT' ],
    author: [ 'admin@jive.server.com' ],
    guid: [ 'https://jive.server.com/docs/DOC-1624' ]
  },
  {
    title: ['Another Group Document'],
    ...
  }
  ...
]

getPersonalDocuments

is a prototype function of the JiveContainer class. It takes an account string and a callback (err, json), where json is the results from Jive's feed. Note: this uses RSS since there is no straight forward API for this. Because of the way 4.5's RSS feed works providing an invalid username will still provide results in some cases. Therefore, verify your username before running this, for consistency.

jive.getPersonalDocuments 'username', (err, json)->
  if err
    console.log err
  else
    console.log json[id].title[0] for id of json

The data returned looks something like this. The "..." indicates a continuation:

[
  {
    title: [ 'A Group Document' ],
    link: [ 'https://jive.server.com/docs/DOC-1624' ],
    description: [ '...' ],
    category: [ ... ],
    ...,
    pubDate: [ 'Wed, 22 Dec 2010 15:22:36 GMT' ],
    author: [ 'admin@jive.server.com' ],
    guid: [ 'https://jive.server.com/docs/DOC-1624' ]
  },
  {
    title: ['Another Group Document'],
    ...
  }
  ...
]

Readme

Keywords

none

Package Sidebar

Install

npm i node-jivesbs-rest

Weekly Downloads

0

Version

0.0.3

License

none

Last publish

Collaborators

  • mike.kunze