Home  >  Plugins  >  BFAPI
JavaScript API Specification
Thursday, July 22, 2010 By:
FirstClass BlueField API 1.0R4 Documentation

The primary use of this API is intended primarily to allow easy construction BlueField "dashboard" panes in other applications or to facilitate "discuss in BlueField" integration in other web sites/applications.  This API is not intended to allow the construction of alternate BlueField interfaces or to allow arbitrary access to any and all objects in BlueField.  For this purpose, users should use the actual BlueField UI.  To this end, the API object supplies a number of 'getxxxxURL' methods that can be used to launch BlueField and navigate to a specific object/user.  These URLs can be passed to the "generateBlueFieldURL" method right before use in order to be given a single sign-on ticket for user convenience.  The validity of such tickets is extremely short lived, so the generated URL should be used at once once retrieved.

Part A: Setup

1) Import the core API file (http://www.BFSiteDomain.com/Plugins/BFAPI/BlueField.pjs) as a JavaScript include.
2) Instantiate an instance of the BFAPI object, passing in the root of the bluefield site (ex: var BFO=new BFAPI("http://www.BFSite.com");).  If the site uses a non-standard port, or if it is configured to use SSL, remember to make the appropriate alterations to the passed in site name.
3) call either checkActiveLogin or doLogin in order to connect to the server.  doLogin always starts a new session on the server, checkActiveLogin will check to see if there is a login session still active from a previous BFAPI instance.

Part B: Methods

Object Methods

boolean cancelRequest(BFRequestID reqid = -1)
integer         getOutstandingRequestCount(void)

Authentication methods

BFRequestID     doLogin(callback(BFRequestID, BFError), string userid, string password)
BFRequestID     checkActiveLogin(callback(BFRequestID, BFError))
BFRequestID     getAuthenticationTicket(callback(BFRequestID, BFError,string ticketparam))
boolean amILoggedIn(void)
void            doLogout(void)

BlueField home screen methods

BFClientid      getMyClientID(void)
url             getMyHomeURL(void)
void            setMyStatusMessage(string message)
BFRequestID     listMyPeople(callback(BFRequestID, BFError, array BFPerson))
void            addToMyPeople(BFClientid cid)
void            removeFromMyPeople(BFClientid cid)
BFRequestID     listMyFollowers(callback(BFRequestID, BFError, array BFPerson))
BFRequestID     listMyCommunities(callback(BFRequestID, BFError, array BFCommunity))

Flagged Items (Watches)

BFRequestID     listMyFlaggedItems(callback(BFRequestID, BFError, array BFFlaggedItem))
url             getFlaggedItemURL(BFFlagid fid)
void            clearFlaggedItemUnread(BFFlagid fid)
void            unFlagItem(BFFlagid fid)

User/Presence methods

url             getUserProfilePicture(BFClientid cid = 0)                 // cid = 0 => current user.
BFRequestID     getUserMiniProfile(callback(BFRequestID, BFError, BFMiniProfile), BFClientid cid = 0)     // cid = 0 => current user.
BFRequestID     lookupUser(callback(BFRequestID, BFError, array BFPerson), string username, string organisationalunit = "")
url             getUserProfileURL(BFClientid cid = 0)                     // cid = 0 => current user.

Blog/Profile methods

BFRequestID     getBlogUnreadCount(callback(BFRequestID, BFError, integer), BFClientid cid = 0)     // cid = 0 => current user.
BFRequestID     listBlogThread(callback(BFRequestID, BFError, BFThread), BFClientid cid, BFThreadid tid)
BFRequestID     flagBlogThread(callback(BFRequestID, BFError, BFFlagid), BFClientid cid, BFThreadid tid)
BFRequestID     createBlogPost(callback(BFRequestID, BFError, BFThreadid), string title, HTMLtext body)
void            postBlogComment(BFClientid cid, BFThreadid tid, HTMLtext body)

Community methods

url             getCommunityURL(BFCommunityid cmid)
BFRequestID     getCommunityDescription(callback(BFRequestID, BFError, HTMLtext), BFCommunityid cmid)
url             getCommunityThreadURL(BCCommunityid cmid, BFThreadid tid)
BFRequestID     listCommunityThread(callback(BFRequestID, BFError, BFThread), BFCommunityid cmid, BFThreadid tid)
BFRequestID     flagCommunityThread(callback(BFRequestID, BFError, BFFlagid), BFCommunityid cmid, BFThreadid tid)
BFRequestID     createCommunityTopic(callback(BFRequestID, BFError, BFThreadid), BFCommunityid cmid, string topic, HTMLtext body)
BFRequestID     createCommunityWiki(callback(BFRequestID, BFError, BFThreadid), BFCommunityid cmid, string title, HTMLtext body)
void            postCommunityComment(BFCommunityid cmid, BFThreadid tid, HTMLtext body)

Part C: Data structures

dates are passed and returned as strings of the form YYYYMMDDHHMMSS in UTC timezone.

strings are length limited unicode character sequences, and should be in canonically composed (NFC) UTF-8.

HTMLtext is length limited NFC UTF-8 HTML.

url is a string that has been escaped so as to be usable as an URL

BFRequestid,BFClientid, BFThreadid, BFCommunityid and BFFlagid are all opaque identifier token strings used by the API.

Any 'callback' is a function intended to be called once an asynchronous operation completes.  The argument list should be as listed, the first two paramters of which will always be the Request ID and an error code.  For any callback, a value of null can be passed, in which case the operation becomes "fire and forget", though this mode of operation may not be very useful depending on what the operation is inteded to do.  In the event of an error, the callback will be called with only the first two parameters (request ID and Error code) filled in.

object BFError{
integer errCode
string errText
}

object BFStatusMessage {
string message
date lastupdate
}

object BFMiniProfile {
string name
boolean isonline
string title
string location
string phone
string email
BFStatusMessage status
}

object BFPerson {
string name
BFClientid cid
boolean isonline
integer blogUnreadCount
}

object BFCommunity {
BFCommunityid cmid
string name
url icon
integer unreadCount
}

object BFThreadListRecord {
BFThreadid tid
integer numcomments
url icon
}

object BFThread {
BFThreadid tid
BFItem root
array BFComment comments
}

object BFItem {
enum type {blogpost, topic, document, wiki, comment}
date lastModified
string title
HTMLtext body
BFAuthor author (Author object)
}

object BFComment {
date postDate
HTMLtext body
BFAuthor author
}

object BFAuthor {
string name
BFClientid cid
}

object BFFlaggedItem {
BFFlagid fid
string title
boolean unread
}


Top of Page