/mcpJavaScript REST Collection Object JavaScript REST Object MediaList Media PhoneBooks PhoneBook Queues Queue Teams Team Users User Significance of REST Collection Object To understand the significance of a REST collection object, consider the example of all the Dialogs associated with a User in a grid. A Dialog is a JavaScript representation of a call. It can be a regular phone call, a conference, or a silent monitor session. A User object can be composed of many other objects, one of which is the Dialogs object. Note that it is Dialogs and not Dialog. This is because a user can be involved in multiple calls. Example—Get Dialogs for a User var _user = new finesse.restservices.User({ id: '1001001', // user id onLoad: function(user) { // User has successfully loaded, now get User Dialogs user.getDialogs({ onLoad: function(dialogs) { // successfully loaded the dialogs collection object, now format and display in the grid var dialogCollection = dialogs.getCollection(); for (dialogId in dialogCollection) { if (dialogCollection[dialogId] instanceOf finesse.restservices.Dialog) { // each item in the Dialogs Collection will be an instance of Dialog object. // can format and display each record here. } } } // for the sake of simplicity of this example, not adding other handlers. }); } }); In the above example, after the User has successfully loaded, you call the getDialogs() API of the User object to get the Dialogs collection object and perform certain operations on it before you display it in a grid. Note that we did not explicitly initialize the Dialogs collection object. The getDialogs() API of the User object did it for us internally. You do not have to explicitly create the collection objects. All the JavaScript REST objects which are composed of such collection object provides certain APIs which are internally taken care of initializing the objects. You must provide the handlers to control once the collection is loaded, modified, or deleted. The following are some examples of APIs which internally initialize and return respective REST collection objects. Example—Collection Objects _team.getUsers // Team REST API Object is composed of a Users Collection Object.(Users who are the part of that team) _user.getMediaList // User REST API Object is composed of MediaList Collection Object. _user.getQueues // User REST API Object is composed of Queues Collection Object. Cisco Finesse Web Services Developer and JavaScript Guide, Release 12.5(1) 449 Cisco Finesse JavaScript APIs REST Collection Objects