PortalServer APIReference
PortalServer APIReference
This publication contains confidential, proprietary, and trade secret information. No part of this document may be copied,
photocopied, reproduced, translated, or reduced to any machine-readable or electronic format without prior written
permission from VBrick Systems, Inc. Information in this document is subject to change without notice and VBrick assumes
no responsibility or liability for any errors or inaccuracies. VBrick, VBrick Systems, the VBrick logo, VEMS Mystro,
StreamPlayer, and StreamPlayer Plus are trademarks or registered trademarks of VBrick Systems, Inc. in the United States
and other countries. Windows Media, SharePoint, OCS and Lync are trademarked names of Microsoft Corporation in the
United States and other countries. All other products or services mentioned in this document are identified by the
trademarks, service marks, or product names as designated by the companies who market those products. Inquiries should be
made directly to those companies. This document may also have links to third-party web pages that are beyond the control of
VBrick. The presence of such links does not imply that VBrick endorses or recommends the content of any third-party web
pages. VBrick acknowledges the use of third-party open source software and licenses in some VBrick products. This freely
available source code is posted at http://www.vbrick.com/opensource
Table of Contents
1 SCOPE ........................................................................................................................................... 4
2 VEMS MYSTRO API OVERVIEW.............................................................................................. 5
2.1 WCF PROXY CLASS ................................................................................................................... 6
2.2 VBBASECONTRACT CLASS ........................................................................................................ 7
3 ENTERING AND EXITING THE SYSTEM ................................................................................ 8
3.1 LOG IN ....................................................................................................................................... 9
3.2 LOG OUT .................................................................................................................................. 10
4 USERS .......................................................................................................................................... 11
4.1 ADD USER ............................................................................................................................... 12
4.2 RETRIEVE USER ....................................................................................................................... 14
4.3 EDIT USER ............................................................................................................................... 16
4.4 DELETE USER .......................................................................................................................... 17
5 GROUPS ...................................................................................................................................... 18
5.1 ADD GROUP............................................................................................................................. 19
5.2 RETRIEVE GROUP..................................................................................................................... 20
5.3 EDIT GROUP ............................................................................................................................ 22
5.4 DELETE GROUP ........................................................................................................................ 23
6 CONTENT CATEGORIES ......................................................................................................... 24
6.1 ADD CONTENT CATEGORY ....................................................................................................... 25
6.2 RETRIEVE CONTENT CATEGORY ............................................................................................... 26
6.3 EDIT CONTENT CATEGORY ....................................................................................................... 27
6.4 DELETE CONTENT CATEGORY .................................................................................................. 28
7 ACCESS CONTROL RIGHTS ................................................................................................... 29
7.1 SET GROUP ACCESS CONTROL LEVEL PERMISSIONS FOR CONTENT CATEGORIES ........................ 30
7.2 SET GROUP ACCESS CONTROL LEVEL PERMISSIONS FOR INDIVIDUAL UNITS OF CONTENT .......... 33
7.3 SET USER ACCESS CONTROL LEVEL PERMISSIONS FOR CONTENT CATEGORIES .......................... 36
7.4 SET USER ACCESS CONTROL LEVEL PERMISSIONS FOR INDIVIDUAL UNITS OF CONTENT ............. 39
7.5 SET CONTENT AS PUBLIC ......................................................................................................... 42
7.6 GET PUBLIC STATUS OF CONTENT ............................................................................................ 43
7.7 SET CONTENT AS PRIVATE ....................................................................................................... 44
7.8 GET PRIVATE STATUS OF CONTENT .......................................................................................... 45
7.9 SET DEFAULT STATUS OF CONTENT .......................................................................................... 46
7.10 GET DEFAULT STATUS OF CONTENT ......................................................................................... 47
8 ADD VIDEO CONTENT ............................................................................................................. 48
8.1 ADD A STANDALONE VIDEO FILE ............................................................................................. 49
8.2 ADD A STORED ENTERED URL ................................................................................................. 53
8.3 ADD A LIVE ENTERED URL ...................................................................................................... 57
9 SEARCHING FOR CONTENT................................................................................................... 61
9.1 CLEAR THE CONTENT CACHE ................................................................................................... 62
9.2 SEARCH FOR CONTENT ............................................................................................................. 63
9.3 SEARCH FOR CONTENT INSTANCES ........................................................................................... 65
10 CONTENT INSTANCES ............................................................................................................. 66
10.1 ADD CONTENT INSTANCE ......................................................................................................... 67
10.2 EDIT CONTENT INSTANCE......................................................................................................... 69
ii
VEMS Mystro API Reference Guide
iii
VEMS Mystro API Reference Guide
1 Scope
This document explains how to accomplish the most commonly used tasks through the VEMS Mystro API. It is
assumed that the reader is an experienced software developer with knowledge of web development, the .NET 4.0
Framework and Windows Communication Foundation (WCF). All code examples are written in C# unless
otherwise noted.
4
VEMS Mystro API Reference Guide
This quick start guide will introduce the proxy object which acts as the intermediary between the GUI and backend.
Also, a special class called VBBaseContract will be briefly examined. Output from just about all API methods return
VBxxx objects, which are all derived from the VBBaseContract class.
This quick start guide will begin with the API calls to log in/log out and then progress to adding, editing and deleting
users, groups, and categories. Once the dynamics of adding, editing and deleting users, groups and categories have
been mastered, more complicated tasks like granting access control rights at the user, group, category and content
level can be explored. Once access control functionality is mastered, the ability to add/edit/delete video content and
video content instances will be explored. Then the ability to start/stop broadcasts, play content on set top boxes,
retrieve embedded code, and finally perform video content searches will be explored.
5
VEMS Mystro API Reference Guide
6
VEMS Mystro API Reference Guide
The purpose of deriving all VBxxx classes from this base class is so that Exceptions that occur on the server side can
be safely communicated back to the calling method. When an exception is communicated back to the calling method
an action can be taken, such as displaying an error message. All VBxxx objects have an Exception field. After calling
an API method, this field must be examined. If the field is null then the API call completed without error. If the
Exception member is populated, then the API call failed. Information about the failure can be found in the Exception
field as well as the ExceptionLog table in the database.
7
VEMS Mystro API Reference Guide
8
VEMS Mystro API Reference Guide
3.1 Log in
A user must log in to VEMS Mystro before any other interaction with the API can be performed.
Syntax:
Inputs:
Output:
VBSession object
The VBSession object returned represents a VEMS Mystro session. The SessionID field of the returned VBSession
object is used when calling all other API methods. Client side code must examine the Exception field of the VBSession
object to determine if the UserLogin operation was successful. If the Exception field is null, the operation was
successful and a valid Session ID should be present in the SessionID field. If the Exception field is not null, then the
log in attempt failed.
if (mySession.Exception != null)
{
//failure code path; do something to indicate to the user that an occur occurred
}
else
{
//success code path; continue on with client application code
}
9
VEMS Mystro API Reference Guide
Syntax:
UserLogout(sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the log out operation.
if (userLogoutResponse.Exception != null)
{
//failure code path; do something to indicate to the user that an occur occurred
}
else
{
//success code path; continue on with client application code
}
10
VEMS Mystro API Reference Guide
4 Users
The VEMS Mystro API provides methods to create, retrieve, edit and delete users. The methods used to
accomplish these tasks are discussed in the following sections.
11
VEMS Mystro API Reference Guide
Syntax:
UserAdd(newUserObj, sessionID)
Inputs:
The following properties on the newUserObj can be set prior to passing this object to the UserAdd method:
Outputs:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the UserAdd
operation.
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
//make sure login was successful, declare variables, populate variables with values from GUI,
etc.
//create user
VBUser myNewUser = new VBUser();
myNewUser.UserName = newUserUserName;
myNewUser.Password = newUserPassword;
myNewUser.PIN = newUserPIN;
myNewUser.IsLDAPUser = false;
myNewUser.EnumUserTypeID = (int)USERTYPE.InteractiveUser;
myNewUser.EnumUserStatusID = (int)USERSTATUS.Active; //Could also be set to TempLock or PermLock
//add user
VBVoidData addUserResponse = sll.UserAdd(myNewUser, mySession.SessionID);
if (addUserResponse.Exception != null)
12
VEMS Mystro API Reference Guide
{
//failure code path
}
else
{
//success code path
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
//failure path, could not logout
}
else
{ //successfully logged out
}
If an exception was not returned, the new user was created. Note that this new user does not have any groups,
roles, or category and content permissions assigned yet. Before this user can be modified, there must be a way
to retrieve a VBUser object representing the current state of this user. This will be discussed in the next section.
13
VEMS Mystro API Reference Guide
Method 1:
Syntax:
UserGetByUserID(targetUserID, sessionID)
Inputs:
Output:
VBUser object
The returned VBUser object represents the user who belongs to the targetUserID.
Method 2:
Syntax:
UserGetByUserName(targetUserName, sessionID)
Inputs:
Output:
VBUser object
The returned VBUser object represents the user who belongs to the targetUserName.
14
VEMS Mystro API Reference Guide
Method 1:
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
if(myTargetUser.Exception != null)
{
//failure path, user with targetUserID was not found
}
else
{
//success path
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
//failure path, could not logout
}
else
{ //successfully logged out
}
Method 2:
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
//make sure login was successful, etc.
if (logOutResponse.Exception != null)
{
//failure path, could not logout
}
else
{ //successfully logged out
}
15
VEMS Mystro API Reference Guide
Syntax:
UserUpdate(targetUserObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the UserUpdate
operation.
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
//retrieve user
VBUser myTargetUser = sll.UserGetByUserName(targetUsername, mySession.SessionID);
//make sure the user was retrieved without error
16
VEMS Mystro API Reference Guide
Syntax:
UserDelete(targetUserObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the UserDelete
operation.
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
//retrieve user
VBUser userToDelete = sll.UserGetByUserName(targetUsername, mySession.SessionID);
if (deleteUserResponse.Exception != null)
{
//failure path, the user was not deleted
}
else
{
//success path
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
//failure path, could not logout
}
else
{ //successfully logged out
}
17
VEMS Mystro API Reference Guide
5 Groups
The VEMS Mystro API provides methods to create, retrieve, edit and delete groups. The methods used to
accomplish these tasks are discussed in the following sections.
18
VEMS Mystro API Reference Guide
Syntax:
GroupAdd(newGroupObj, sessionID)
Inputs:
The following properties on the newGroupObj can be set prior to passing this object to the GroupAdd method:
Output:
VBGroup object
The VBGroup object returned represents the new Group that was just created. The client code should examine
this object’s Exception field to determine if an error occurred while attempting to create this new group.
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
//make sure login was successful, etc.
if (newGroupRet.Exception != null)
{
//failure path
}
else
{
//success path
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
19
VEMS Mystro API Reference Guide
Method 1:
Syntax:
GroupGet(targetGroupID, sessionID)
Inputs:
Output:
VBGroup object
The VBGroup object returned represents the Group associated with the targetGroupID. The client side code
should examine the Exception field to determine if an error occurred during the GroupGet operation.
Method 2:
Syntax:
GroupsGetAll(sessionID)
Inputs:
Output:
VBList<VBGroup>
The returned VBList<VBGroup> represents a List of all the Groups in the system. The client code should examine
the Exception field to determine if an error occurred during the GroupsGetAll operation.
A developer can use this method inside of a custom GroupGetByXX method to search for a group based on its
name, description, or some other custom criteria.
20
VEMS Mystro API Reference Guide
Method 1:
Method 2:
//login
VBSession mySession = sll.UserLogin(Username, password, ApplicationID, ClientIP, UserLanguage);
//make sure login was successful, etc.
string groupName = "groupNameToSearchFor";
if (targetGroup != null)
{
//found the targetGroup
}
else
{
//could not find the targetGroup
}
21
VEMS Mystro API Reference Guide
Syntax:
GroupUpdate(groupToUpdateObj, sessionID)
Inputs:
Output:
VBGroup object
The VBGroup object returned represents the updated group. The client code should examine this object’s
Exception field to determine if an error occurred during the GroupUpdate operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
if (targetGroupForUpdate != null)
{ //modify the desired fields
targetGroupForUpdate.Name = "newName";
targetGroupForUpdate.Description = "newDescription";
}
else
{
throw new Exception(“Could not find target group”);
}
22
VEMS Mystro API Reference Guide
Syntax:
GroupDelete(groupToDeleteObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the GroupDelete
operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//get reference to this target group (the implementation of customGetGroupByName not shown here)
VBGroup targetGroupForUpdate = customGetGroupByName(sll, mySession.SessionID, groupNameToDel);
if (targetGroupForUpdate == null)
{
throw new Exception ("Could not find Group with Name: " + groupNameToDel);
}
if (deleteGroupResponse.Exception != null)
{
//failure path (the group was not deleted)
}
else
{
//success path
}
23
VEMS Mystro API Reference Guide
6 Content Categories
The VEMS Mystro API provides methods to create, retrieve, edit and delete content categories. The methods
used to accomplish these tasks are discussed in the following sections.
24
VEMS Mystro API Reference Guide
Syntax:
CategoryAdd(categoryToAddObj, sessionID)
Inputs:
The following properties on the categoryToAddObj can be set prior to passing this object to the CategoryAdd
method:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the CategoryAdd
operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
if (addCategoryResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
25
VEMS Mystro API Reference Guide
Syntax:
CategoriesGetAll(sessionID)
Inputs:
Output:
VBList<VBCategory>
The VBList<VBCategory> object returned from the method is a List of VBCategory objects representing all of the
Categories in the system. The Exception field of this object should be examined to determine if an error occurred
during the CategoriesGetAll operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
VBCategory targetCategory;
foreach(VBCategory currentCat in allCategories.Entities)
{
if (currentCat.Name == catName)
{
targetCategory = currentCat;
break;
}
}
return targetCategory;
}
26
VEMS Mystro API Reference Guide
Syntax:
CategoryUpdate(categoryToUpdateObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the CategoryUpdate
operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
if (updateCategoryResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
27
VEMS Mystro API Reference Guide
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the CategoryDelete
operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
if (deleteCategoryResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
28
VEMS Mystro API Reference Guide
There are six access control levels available. These levels are Add, View, Share, Edit, Delete and Admin. All access
control permissions set at the content category level propagate down to each individual unit of content contained
therein, unless there are explicit content permissions set for individual units of content. Individual content permissions
supersede permissions set at the category level.
The Add access control level means that the grantee (user or group) has the ability to add content to a particular
content category. The View access control level means that the grantee has the ability to view a content category and
view all content contained therein (unless this permission is overridden at the individual content level). The Share
access control level means that the grantee has the ability to share the content category and all content contained
therein. This access control level is always set to the same value as the View access control level. The Edit access
control level means that the grantee has the ability to edit a content category and edit any of the content contained
therein (unless this permission is overridden at the individual content level). The Delete access control level means
that the grantee has the ability to delete a content category and delete any content contained therein (unless this
permission is overridden at the individual content level). When a unit of content is deleted from a category, it is not
physically deleted from the system; it is just no longer a member of that category and becomes a member of the
“Uncategorized” pseudo category. The Admin access control level means that the grantee has the ability to modify the
access control rights of a content category and that of all content contained therein (unless this permission is
overridden at the individual content level).
The access control rights described above can be applied to content categories and individual units of content for users
and groups. The highest priority are the permissions set at individual units of content; these permissions will
supersede any permissions set at the category level. These individual content permissions for a user and his group(s)
are unioned together and applied. If no individual content permissions are set, then the content category permissions
that belong to the user and his group(s) are unioned and applied.
In addition to the six access control levels examined here, an individual unit of content can have content permissions
set to Default, Public or Private. Content marked as Default means that the access control permissions discussed
above are in effect. Content marked as Public means that every user in the system is implicitly granted View access
only, even if a user is explicitly denied View access. Content marked as Private means that the content does not
inherit any permissions set at the content category level. Only the individual content permissions set for a user and his
group(s) (if any exist) are unioned and applied.
29
VEMS Mystro API Reference Guide
7.1 Set Group Access Control Level Permissions for Content Categories
The VEMS Mystro API provides the ability to retrieve and update the access control level permissions for content
categories and individual units of content contained therein at the group level. Setting access control level
permissions for content categories will be explored first, followed by setting access control permissions for
individual units of content in 20.2. There are three methods involved with the retrieval and update of content
category access control permissions. Each method will be explained below and then a code sample
demonstrating their use will be presented and explained.
Method 1:
Syntax:
CategoriesGetAllWithGroupPermissions(targetGroupID, sessionID)
Inputs:
Output:
VBList<VBCategory>
The VBList<VBCategory> object returned is a VBList of VBCategory objects. Within each VBCategory object
there is a CategoryPermission field which will contain a VBCategoryPermission object, if and only if there are
permissions assigned, otherwise this field is null. Also examine the Exception field to determine if an error
occurred during the CategoriesGetAllWithGroupPermissions operation.
Method 2:
Syntax:
ContentCategoryPermissionsDefaultGroupGet(targetGroupID, sessionID)
Inputs:
Output:
VBDefaultContentCategoryPermissions object
The VBDefaultContentCategoryPermissions object returned contains the default content category permissions
assigned to the group. These defaults are determined by unioning all the category permissions of the feature sets
that the group belongs too. Examine the Exception field to determine if an error occurred during the
ContentCategoryPermissionsDefaultGroupGet operation.
30
VEMS Mystro API Reference Guide
Method 3:
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
CategoryContentPermissionsUpdateByGroup operation.
Example Client Code: (Note that login/logout code is not shown here for clarity)
31
VEMS Mystro API Reference Guide
else
{//all other categories
if (allCategoriesWithGroupPermissions.Entities[i].CategoryPermission == null)
{
//no permissions are defined for this category, so just default all permissions to false
categoryPermissions.Read = false;
categoryPermissions.Delete = false;
categoryPermissions.Edit = false;
categoryPermissions.Add = false;
categoryPermissions.Admin = false;
categoryPermissions.Share = false;
categoryPermissions.IsCustomized = false;
allCategoriesWithGroupPermissions.Entities[i].IsCategoryValueChanged = false;
}
else
{
//use the existing permissions for this category
categoryPermissions.Read =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.Read;
categoryPermissions.Delete =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.Delete;
categoryPermissions.Edit =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.Edit;
categoryPermissions.Add =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.Add;
categoryPermissions.Admin =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.Admin;
categoryPermissions.Share =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.Share;
categoryPermissions.IsCustomized =
allCategoriesWithGroupPermissions.Entities[i].CategoryPermission.IsCustomized;
allCategoriesWithUserPermissions.Entities[i].IsCategoryValueChanged = true; //must be set
to true anytime permissions differ from the default permissions
allCategoriesWithUserPermissions.Entities[i].CategoryPermission = categoryPermissions;
}
}
32
VEMS Mystro API Reference Guide
7.2 Set Group Access Control Level Permissions for Individual units of Content
The VEMS Mystro API provides the ability to retrieve and update the access control permission levels of individual
units of content contained within content categories, at the group level. There are three methods involved with the
retrieval and update of the access control permissions for individual units of content. Each method will be explained
below and then a code sample demonstrating their use will be presented.
Method 1:
Syntax:
Inputs:
Output:
VBList<VBAdminContent>
Method 2:
Syntax:
ContentCategoryPermissionsDefaultGroupGet(targetGroupID, sessionID)
Inputs:
Output:
VBDefaultContentCategoryPermissions object
The VBDefaultContentCategoryPermissions object returned contains the default content category permissions
assigned to the group. These defaults are determined by unioning all the category permissions of the feature sets
that the group belongs too. The Exception field should be examined to determine if an error occurred during the
ContentCategoryPermissionsDefaultGroupGet operation.
33
VEMS Mystro API Reference Guide
Method 3:
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentPermissionsUpdateByGroup operation.
Example Client Code: (Note that login/logout code is not shown here for clarity)
//set permission on the target content (grant read and edit access)
contentPermissions.Admin = false;
contentPermissions.Default = false;
contentPermissions.Delete = false;
contentPermissions.Edit = true;
contentPermissions.Read = true;
contentPermissions.Share = true;
34
VEMS Mystro API Reference Guide
contentPermissions.Edit = false;
contentPermissions.Read = false;
contentPermissions.Share = false;
contentPermissions.IsCustomized = false;
}
else
{
//content has existing permissions, so just use those
contentPermissions.Admin = allContentWithinCategory.Entities[i].ContentPermission.Admin;
contentPermissions.Default =
allContentWithinCategory.Entities[i].ContentPermission.Default; //Default is always false
contentPermissions.Delete = allContentWithinCategory.Entities[i].ContentPermission.Delete;
contentPermissions.Edit = allContentWithinCategory.Entities[i].ContentPermission.Edit;
contentPermissions.Read = allContentWithinCategory.Entities[i].ContentPermission.Read;
contentPermissions.Share = allContentWithinCategory.Entities[i].ContentPermission.Share;
contentPermissions.IsCustomized =
allContentWithinCategory.Entities[i].ContentPermission.IsCustomized;
}
}
//assign permissions to current content record
allContentWithinCategory.Entities[i].ContentPermission = contentPermissions;
}
//make update
VBVoidData updateContentPermissionResponse = sll.ContentPermissionsUpdateByGroup(targetGroupID, targetedContent,
sessionID);
35
VEMS Mystro API Reference Guide
7.3 Set User Access Control Level Permissions for Content Categories
The VEMS Mystro API provides the ability to retrieve and update the access control level permissions for content
categories and individual units of content contained therein at the user level. Setting access control level
permissions for content categories will be explored first, followed by setting access control permissions for
individual units of content in 20.4. There are three methods involved with the retrieval and update of content
category access control permissions. Each method will be explained below and then a code sample
demonstrating their use will be presented.
Method 1:
Syntax:
CategoriesGetAllWithUserPermissions(targetUserID, sessionID)
Inputs:
Output:
VBList<VBCategory>
The VBList<VBCategory> object returned is a VBList of VBCategory objects. Within each VBCategory object
there is a CategoryPermission field which will contain a VBCategoryPermission object, if and only if there are
permissions assigned, otherwise this field is null. The Exception field should be examined to determine if an error
occurred during the CategoriesGetAllWithUserPermissions operation.
Method 2:
Syntax:
ContentCategoryPermissionsDefaultUserGet(targetUserID, sessionID)
Inputs:
Output:
VBDefaultContentCategoryPermissions object
The VBDefaultContentCategoryPermissions object returned contains the default content category permissions
assigned to the user. These defaults are determined by unioning all the category permissions of the feature sets
that the user belongs too. Examine the Exception field to determine if an error occurred during the
ContentCategoryPermissionsDefaultUserGet operation.
36
VEMS Mystro API Reference Guide
Method 3:
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
CategoryContentPermissionsUpdateByGroup operation.
Example Client Code: (Note that login/logout code is not shown here for clarity)
allCategoriesWithUserPermissions.Entities[i].IsCategoryValueChanged = true;
allCategoriesWithUserPermissions.Entities[i].CategoryPermission = categoryPermissions;
}
else
37
VEMS Mystro API Reference Guide
if (allCategoriesWithUserPermissions.Entities[i].CategoryPermission == null)
{
//no permissions are defined, so just default all permissions to false
categoryPermissions.Read = false;
categoryPermissions.Delete = false;
categoryPermissions.Edit = false;
categoryPermissions.Add = false;
categoryPermissions.Admin = false;
categoryPermissions.Share = false;
categoryPermissions.IsCustomized = false;
allCategoriesWithUserPermissions.Entities[i].IsCategoryValueChanged = false;
}
else
{
//use the existing permissions
categoryPermissions.Read =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.Read;
categoryPermissions.Delete =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.Delete;
categoryPermissions.Edit =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.Edit;
categoryPermissions.Add =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.Add;
categoryPermissions.Admin =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.Admin;
categoryPermissions.Share =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.Share;
categoryPermissions.IsCustomized =
allCategoriesWithUserPermissions.Entities[i].CategoryPermission.IsCustomized;
allCategoriesWithUserPermissions.Entities[i].IsCategoryValueChanged = true; //must be set
to true anytime permissions differ from the default permissions
}
allCategoriesWithUserPermissions.Entities[i].CategoryPermission = categoryPermissions;
}
}
38
VEMS Mystro API Reference Guide
7.4 Set User Access Control Level Permissions for Individual units of Content
The VEMS Mystro API provides the ability to retrieve and update the access control permission levels of individual
units of content contained within content categories, at the user level. There are three methods involved with the
retrieval and update of the access control permissions for individual units of content. Each method will be explained
below and then a code sample demonstrating their use will be presented.
Method 1:
Syntax:
Inputs:
Output:
VBList<VBAdminContent>
Method 2:
Syntax:
ContentCategoryPermissionsDefaultUserGet(targetUserID, sessionID)
Inputs:
Output:
VBDefaultContentCategoryPermissions object
The VBDefaultContentCategoryPermissions object returned contains the default content category permissions
assigned to the group. These defaults are determined by unioning all the category permissions of the feature sets
that the group belongs too. The Exception field should be examined to determine if an error occurred during the
ContentCategoryPermissionsDefaulUserGet operation.
39
VEMS Mystro API Reference Guide
Method 3:
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentPermissionsUpdateByUser operation.
Example Client Code: (Note that login/logout code is not shown here for clarity)
//set permission on the target content (grant read and edit access)
contentPermissions.Admin = false;
contentPermissions.Default = false;
contentPermissions.Delete = false;
contentPermissions.Edit = true;
contentPermissions.Read = true;
contentPermissions.Share = true;
40
VEMS Mystro API Reference Guide
contentPermissions.Delete = false;
contentPermissions.Edit = false;
contentPermissions.Read = false;
contentPermissions.Share = false;
contentPermissions.IsCustomized = false;
}
else
{
//content has existing permissions, so just use those
contentPermissions.Admin = allContentWithinCategory.Entities[i].ContentPermission.Admin;
contentPermissions.Default =
allContentWithinCategory.Entities[i].ContentPermission.Default; // Default is always false
contentPermissions.Delete = allContentWithinCategory.Entities[i].ContentPermission.Delete;
contentPermissions.Edit = allContentWithinCategory.Entities[i].ContentPermission.Edit;
contentPermissions.Read = allContentWithinCategory.Entities[i].ContentPermission.Read;
contentPermissions.Share = allContentWithinCategory.Entities[i].ContentPermission.Share;
contentPermissions.IsCustomized =
allContentWithinCategory.Entities[i].ContentPermission.IsCustomized;
}
}
//assign permissions to current content record
allContentWithinCategory.Entities[i].ContentPermission = contentPermissions;
}
//make update
VBVoidData updateContentPermissionResponse = sll.ContentPermissionsUpdateByUser(targetUserID, targetedContent,
sessionID);
41
VEMS Mystro API Reference Guide
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentPublicStatusSet operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//Get content of interest from GUI, or search, etc (not shown here)
VBContent contentOfInterest;
if (setContentToPublicResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
42
VEMS Mystro API Reference Guide
Syntax:
ContentGetPublicStatus(contentID, sessionID)
Inputs:
Output:
VBBoolData object
The VBBoolData object returned allows client code to determine the Public status of a unit of content by
examining the ReturnValue field of the object. If this field is set to true, the content is Public, otherwise the
content is not designated as Public. The Exception field should be examined to determine if an error occurred
during the ContentGetPublicStatus operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//Get content of interest from GUI, or search, etc (not shown here)
VBContent contentOfInterest;
bool contentStatus;
if (contentOfInterestPublicStatus.Exception != null)
{
//failure path
}
else
{
//success path
contentStatus = contentOfInterestPublicStatus.ReturnValue;
//take action based on status
}
//log out
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) //failure path
43
VEMS Mystro API Reference Guide
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentPrivateStatusSet operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//Get content of interest from GUI, or search, etc (not shown here)
VBContent contentOfInterest;
if (setPrivateStatusResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
//log out
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) //failure path
44
VEMS Mystro API Reference Guide
Syntax:
ContentGetPrivateStatus(contentID, sessionID)
Inputs:
Output:
VBBoolData object
The VBBoolData object returned allows client code to determine the Private status of a unit of content by
examining the ReturnValue field of the object. If this field is set to true, the content is Private, otherwise the
content is not designated as Private. The Exception field should be examined to determine if an error occurred
during the ContentGetPrivateStatus operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//Get content of interest from GUI, or search, etc (not shown here)
VBContent contentOfInterest;
bool contentStatus;
if (contentOfInterestPrivateStatus.Exception != null)
{
//failure path
}
else
{
//success path
contentStatus = contentOfInterestPrivateStatus.ReturnValue;
//take action based on status
}
//log out
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) //failure path
45
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//Get content of interest from GUI, or search, etc (not shown here)
VBContent contentOfInterest;
//log out
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) //failure path
46
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
//verify that login was successful
//Get content of interest from GUI, or search, etc (not shown here)
VBContent contentOfInterest;
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
//failure path
}
else
{
//success path
}
47
VEMS Mystro API Reference Guide
48
VEMS Mystro API Reference Guide
Method 1:
Syntax:
IsFileIngestableBasedOnExtension(fileName, sessionID)
Inputs:
Output:
VBBoolData object
The VBBoolData object returned allows client side code to determine if the video is ingestible by examining its
ReturnValue field. If the value is true, the video is ingestible otherwise the video is not ingestible. The Exception
field should also be examined to determine if any errors occurred during the IsFileIngestableBasedOnExtension
operation.
Method 2:
Syntax:
ContentSeedCreateForAddVideo(sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned allows client side code to retrieve the new content ID by examining its ReturnValue
field. This content ID will be assigned to the new video. The Exception field should also be examined to
determine if any errors occurred during the ContentSeedCreateForAddVideo operation.
49
VEMS Mystro API Reference Guide
Method 3:
Syntax:
ContentTitleDescriptionUpdate(vbContentObj, sessionID)
Inputs:
The following fields must be set on the vbContentObj prior to passing it to ContentTitleDescriptionUpdate:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentTitleDescriptionUpdate operation.
Method 4:
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentUploadedVideoAdd operation.
50
VEMS Mystro API Reference Guide
Method 4:
Syntax:
ContentFtpStatusGetAllByUser(sessionID)
Inputs:
Output:
VBList<VBRequestFtp> object
The VBList<VBRequestFtp> object returned is a List of VBRequestFtp objects. Each VBRequestFtp object
corresponds to an FTP requested initiated by the user that invoked the method. There will be a VBRequestFtp
object for each video that is added to the system. The Exception field should be examined to determine if an
error occurred during the ContentFtpStatusGetAllByUser operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null)
{
throw new Exception("UserLogin failed. See the ExceptionLog table for details");
}
string testVideoFilenameWithExtension; //get filename from GUI, etc (not shown here).
string completeSourcePathNameOfVideoFile; //get filename from GUI, etc (not shown here).
//copy the standalone video file into the VOD folder. This folder structure should exist on every PC based
client. The API is expecting the video file to be there.
File.Copy(
completeSourcePathNameOfVideoFile,
@"c:\inetpub\ftproot\VBrick\VOD\" + testVideoFilenameWithExtension
);
//Step 1
//determine if the video file is ingestible
VBBoolData isNewVideoIngestible = sll.IsFileIngestableBasedOnExtension(testVideoFilenameWithExtension,
mySession.SessionID);
if (isNewVideoIngestible.Exception != null)
{
throw new Exception("IsFileIngestableBasedOnExtension failed. See the ExceptionLog table for details");
}
if (!isNewVideoIngestible.ReturnValue)
{ //the video file type is not compatible with the stored servers in the system
throw new Exception("The video file is not ingestible");
}
//Step 2
//generate a Content ID for the new video
VBIntData contentIDOfNewVideo = sll.ContentSeedCreateForAddVideo(mySession.SessionID);
if (contentIDOfNewVideo.Exception != null)
{
throw new Exception("ContentSeedCreateForAddVideo failed. See the ExceptionLog table for details");
}
51
VEMS Mystro API Reference Guide
//Step 3
//assign the title and description to the new video content
VBVoidData updateContentTitleAndDescResponse = sll.ContentTitleDescriptionUpdate(newUploadedVideoContent,
mySession.SessionID);
if (updateContentTitleAndDescResponse.Exception != null)
{
throw new Exception("ContentTitleDescriptionUpdate failed. See the ExceptionLog table for details");
}
//Step 4
//upload the video file and start ingesting it
VBVoidData uploadVideoResponse = sll.ContentUploadedVideoAdd(testVideoFilenameWithExtension,
contentIDOfNewVideo.ReturnValue, mySession.SessionID);
if (uploadVideoResponse.Exception != null)
{
throw new Exception("ContentUploadedVideoAdd failed. See the ExceptionLog table for details");
}
//ensure that the video file was successfully FTP'd from the VOD folder
VBList<VBRequestFtp> allUserRecordingsFtpStatus = sll.ContentFtpStatusGetAllByUser(mySession.SessionID);
if (allUserRecordingsFtpStatus.Exception != null)
{
throw new Exception("ContentFtpStatusGetAllByUser failed. See the ExceptionLog table for details");
}
if (!isFTPdSuccessfully)
{
//the file was not successfully FTP'd. This means that the video file was not ingested into the system.
//There most likely is a problem with the FTP configuration.
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
throw new Exception("UserLogout failed. See the ExceptionLog table for details");
}
52
VEMS Mystro API Reference Guide
Method 1:
Syntax:
ContentSeedCreateForAddVideo(sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned allows client side code to retrieve the new content ID by examining its ReturnValue
field. This content ID will be assigned to the new stored URL. The Exception field should also be examined to
determine if any errors occurred during the ContentSeedCreateForAddVideo operation.
Method 2:
Syntax:
ContentTitleDescriptionUpdate(vbContentObj, sessionID)
Inputs:
The following fields must be set on the vbContentObj prior to passing it to ContentTitleDescriptionUpdate:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentTitleDescriptionUpdate operation.
53
VEMS Mystro API Reference Guide
Method 3:
Syntax:
Inputs:
The following fields must be set on the vbContentObj prior to passing it to ContentAddExternalURL:
The following fields must be set on a new VBContentInstance object prior to adding it to the ContentInstances
List:
Method 4:
Syntax:
ContentIsSeedUpdate(vbContentObj, sessionID)
Inputs:
The following fields must be set on the vbContentObj prior to passing it to ContentIsSeedUpdate:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentIsSeedUpdate operation.
54
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null)
{
throw new Exception("UserLogin failed. See the ExceptionLog table for details");
}
//populate these stored url parameters from the GUI, etc (not shown here)
int bitRate;
int durationInSeconds;
int encodingTypeID;
string videoURL;
55
VEMS Mystro API Reference Guide
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
throw new Exception("UserLogout failed. See ExceptionLog table for details");
}
56
VEMS Mystro API Reference Guide
Method 1:
Syntax:
ContentSeedCreateForAddVideo(sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned allows client side code to retrieve the new content ID by examining its ReturnValue
field. This content ID will be assigned to the new stored URL. The Exception field should also be examined to
determine if any errors occurred during the ContentSeedCreateForAddVideo operation.
Method 2:
Syntax:
ContentTitleDescriptionUpdate(vbContentObj, sessionID)
Inputs:
The following fields must be set on the vbContentObj prior to passing it to ContentTitleDescriptionUpdate:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentTitleDescriptionUpdate operation.
57
VEMS Mystro API Reference Guide
Method 3:
Syntax:
The following fields must be set on the vbContentObj prior to passing it to ContentAddExternalURL:
The following fields must be set on a new VBContentInstance object prior to adding it to the ContentInstances
List:
Method 4:
Syntax:
ContentIsSeedUpdate(vbContentObj, sessionID)
Inputs:
The following fields must be set on the vbContentObj prior to passing it to ContentIsSeedUpdate:
Output:
VBVoidData object
58
VEMS Mystro API Reference Guide
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentIsSeedUpdate operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null)
{
throw new Exception("UserLogin failed. See the ExceptionLog table for details");
}
//populate these stored url parameters from the GUI, etc (not shown here)
int bitRate;
int durationInSeconds;
int encodingTypeID;
string videoURL;
string ipAddress;
string isMulticastURL;
59
VEMS Mystro API Reference Guide
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
throw new Exception("UserLogout failed. See ExceptionLog table for details");
}
60
VEMS Mystro API Reference Guide
**Search caveats:
1. The SearchContent and SearchContentNoCache methods automatically apply filtering according to the
access control rights discussed in section 8, as well as filtering based on zones. This means that a
search will not return any content that a user does not have permission for, or any search results that are
not available to his zone.
2. There is no direct to way to arbitrarily retrieve all content available to a specific user. One way to
accomplish this task would be to login with the target user, perform a search for all stored content,
perform a search for all live content, and then combine the results.
3. There is no direct way to arbitrarily retrieve all content available to a specific group. One way to
accomplish this task would be to create a user and assign him to the target group. Do not assign any
user level permissions to this “shell” user. Login in with this user and perform a search for all stored
content, perform a search for all live content, and then combine the results.
61
VEMS Mystro API Reference Guide
Syntax:
ContentSearchCacheClear(sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentSearchCacheClear operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null)
{
throw new Exception("UserLogin failed. See the ExceptionLog table for details");
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed.");
62
VEMS Mystro API Reference Guide
Syntax:
SearchContent(vbSearchFilterObj, sessionID)
SearchContentNoCache(vbSearchFilterObj, sessionID)
Inputs:
The most often used fields that can be set on vbSearchFilterObj prior to passing it to SearchContent are:
Name Description Type
EnumContentTypeID Value indicating the content type to search for int
EnumSearchFieldID Value indicating the field the search string will be int
searched against (title, description, etc)
EnumSortByField Value indicating the field the returned content will int
be sorted by (title, description, etc)
SearchString The text to search for string
ContentIDs The ContentIDs to search for. This is only used when List<int>
searching for content instances
Categories The search will only take place within the categories List<VBCategory>
added to this list. Leave null to search all
categories.
DisplayNum Number of results to display for pagination purposes int
DisplaySection Section of content that should be displayed (always int
set to 1)
IsSortAsc Flag indicating whether or not to sort results boolean
ascending
IncludeInstances Flag indicating whether or not to include content boolean
instance records with content records
IsInChannelGuideMode Flag indicating whether or not to only include boolean
content that should be included in the channel guide
PresentationOnly Flag indicating whether or not to only include boolean
Presentations, usually originating from live webcasts
ExcludeEnteredURL Flag indicating whether or not to exclude Entered boolean
URLs from results
ExcludeFlashContent Flag indicating whether or not to exclude Flash boolean
content from results
ExcludePresentationContent Flag indicating whether or not to exclude boolean
presentation content from results
ExcludeUnviewedContent Flag indicating whether or not to exclude content boolean
that has not been viewed yet
ExcludeVODMulticast Flag indicating whether or not to exclude multicast boolean
content
ExcludePendingScheduledEven Flag indicating whether or not to exclude any pending boolean
tsIfInChannelGuideMode scheduled events while in Channel Guide mode
63
VEMS Mystro API Reference Guide
Output:
VBContentList<VBContent>
The VBContentList<VBContent> object returned contains a list of VBContent objects representing all search
criteria matches. Note that the VBContentList class is derived from the VBList class and either one can be used
to store the returned results. The Exception field should be examined to determine if any errors occurred during
the SearchContent or SearchContentNoCache operations.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table for details");
//retrieve search string, content type and category IDs (optionally) from GUI (not shown here)
string searchText;
int contentTypeID;
List<int> onlySearchInTheseCategories;
//can restrict search to limited number of categories if desired, otherwise all categories are searched
filterForContentSearch.Categories = onlySearchInTheseCategories;
//these fields are used by the GUI and won’t affect the results returned from the search
filterForContentSearch.EnumSortByFieldID = (int)SORTBYFIELD.Title; //SORTBYFIELD enum value
filterForContentSearch.IsSortAsc = true;
filterForContentSearch.DisplayNum = 10; //good default value to use
filterForContentSearch.DisplaySection = 1; //good default value to use
//now that the filter has been created, call either SearchContent or SearchContentNoCache
VBContentList<VBContent> allMatchedContent;
allMatchedContent = sll.SearchContentNoCache(filterForContentSearch, mySession.SessionID);
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed.");
64
VEMS Mystro API Reference Guide
Syntax:
Fields:
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve contentIDs of target content from GUI, etc (not shown here)
List<int> allTargetContentIDs;
VBContentList<VBContent> allFoundContentInstances;
allFoundContentInstances = sll.SearchContent(myNewSearchFilter, mySession.SessionID);
//SearchContent returns VBContent objects. Within each VBContent object the ContentInstances
//field contains all the content instances for that content record
foreach(VBContent currentContent in allFoundContentInstances.Entities)
{
foreach(VBContentInstance currentContentInstance in currentContent.ContentInstances)
{
//access and process content instances here
}
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed.");
65
VEMS Mystro API Reference Guide
10 Content Instances
The VEMS Mystro API provides the ability to add, edit and delete content instances. A unit of content can be
associated with different versions of itself; each version can have its own bit rate, content type, encoding type and
URL. These different versions are referred to as content instances.
66
VEMS Mystro API Reference Guide
Syntax:
EnteredURLInstanceAdd(contentInstanceObj, sessionID)
Inputs:
The following fields must be set on the contentInstanceObj prior to passing it to EnteredURLInstanceAdd:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
EnteredURLInstanceAdd operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve content ID of target content from GUI, etc (not shown here)
int targetContentID;
//retrieve the information needed for the new content instance from GUI, etc (not shown here)
int bitrate;
int duration;
int contentTypeID;
int encodingTypeID;
string contentInstanceURL;
67
VEMS Mystro API Reference Guide
VBVoidData addContentInstanceResponse;
addContentInstanceResponse = sll.EnteredURLInstanceAdd(myNewContentInstance,
mySession.SessionID);
if (addContentInstanceResponse.Exception != null)
{
throw new Exception("EnteredURLInstanceAdd failed.")
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null)
{
throw new Exception("UserLogout failed.");
}
68
VEMS Mystro API Reference Guide
Syntax:
EnteredURLInstanceUpdate(contentInstanceToEditObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
EnteredURLInstanceUpdate operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve new bit rate, duration and URL from GUI,etc (not shown here)
int newBitRate;
int newDuration;
string newURL;
VBVoidData updateInstanceResponse;
updateInstanceResponse = sll.EnteredURLInstanceUpdate(instanceOfInterest, mySession.SessionID);
if (updateInstanceResponse.Exception != null)
{
throw new Exception("EnteredURLInstanceUpdate failed. See ExceptionLog for details");
}
//continue working…
//logout
VBSession logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed");
69
VEMS Mystro API Reference Guide
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentStoredDeleteFromStoredServer operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve content ID of content with instance that needs to be removed (not shown here)
int targetContentID;
VBContentList<VBContent> allFoundContentInstances;
allFoundContentInstances = sll.SearchContent(myNewSearchFilter, mySession.SessionID);
70
VEMS Mystro API Reference Guide
VBVoidData removeInstanceResponse;
if (allFoundContentInstances.Entities.Count == 1) //only one unit of content should be returned
{
VBContent contentToWorkWith = allFoundContentInstances.Entities[0];
//let’s just remove the first instance, and if it’s the only instance remove the content
int instanceCount = contentToWorkWith.ContentInstances.Count;
if (instanceCount == 1)
{
removeInstanceResponse =
sll.ContentStoredDeleteFromStoredServer(contentToWorkWith.ContentInstances[0].Cont
entInstanceID, true, mySession.SessionID);
if (removeInstanceResponse.Exception != null)
{
throw new Exception ("ContentStoredDeleteFromStoredServer failed")
}
}
else
{
removeInstanceResponse =
sll.ContentStoredDeleteFromStoredServer(contentToWorkWith.ContentInstances[0].Cont
entInstanceID, false, mySession.SessionID);
if (removeInstanceResponse.Exception != null)
{
throw new Exception ("ContentStoredDeleteFromStoredServer failed")
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logoutResponse.Exception != null) throw new Exception("UserLogout failed");
}
else
{
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logoutResponse.Exception != null) throw new Exception("UserLogout failed");
71
VEMS Mystro API Reference Guide
72
VEMS Mystro API Reference Guide
Method 1:
Syntax:
PlayContentLoadWithPlayerController(targetContentID, sessionID)
Inputs:
Output:
VBPlayContentInfo object
The VBPlayContentInfo object returned contains a VBContentInstance object with a URL to play the content
along with a PlayerController object that contains the JavaScript code used to control the client side player. The
Exception field should be examined to determine if an error occurred during the
PlayContentLoadWithPlayerController operation.
Method 2:
Syntax:
PlayContentLogStart(contentInstanceToPlay, sessionID)
Inputs:
Output:
VBContentInstance object
The VBContentInstance object returned contains an ActivityLogID which corresponds to the log entry made in the
database for the play request. This ActivityLogID will become useful when it comes time to stop playing the
content. The Exception field should be examined to determine if an error occurred during the
PlayContentLogStart operation.
73
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve content ID of content to play by doing a search based on input from GUI (not shown)
int targetContentID;
if (targetContentPlayInfo.Exception != null)
{
throw new Exception("PlayContentLoadWithPlayerController failed");
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed");
74
VEMS Mystro API Reference Guide
Method 1:
Syntax:
PlayContentInstanceLoadWithPlayerController(contentInstanceToPlayObj, sessionID)
Inputs:
Output:
VBPlayContentInfo object
The VBPlayContentInfo object returned contains a VBContentInstance object with a URL to play the content
along with a PlayerController object that contains the JavaScript code used to control the client side player. The
Exception field should be examined to determine if an error occurred during the
PlayContentInstanceLoadWithPlayerController operation.
Method 2:
Syntax:
PlayContentLogStart(contentInstanceToPlay, sessionID)
Inputs:
Output:
VBContentInstance object
The VBContentInstance object returned contains an ActivityLogID which corresponds to the log entry made in the
database for the play request. This ActivityLogID will become useful when it comes time to stop playing the
content. The Exception field should be examined to determine if an error occurred during the
PlayContentLogStart operation.
75
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve content ID of content to play by doing a search based on input from GUI (not shown)
int targetContentID;
VBList<VBContent> allInstancesOfTargetContent;
allInstancesOfTargetContent = sll.SearchContent(myNewSearchFilter, mySession.SessionID);
if (allInstancesOfTargetContent.Exception != null)
{
throw new Exception("SearchContent failed");
}
//retrieve search criteria from GUI for the desired content instance, let’s say a specific
//encoding type (not shown here)
int targetEncodingTypeID;
VBContentInstance targetInstanceToPlay;
targetInstanceToPlay = allInstancesOfTargetContent.Entities.Find(myInstance =>
myInstance.EnumEncodingTypeID == targetEncodingTypeID);
if (targetInstanceToPlay == null) throw new Exception("Could not find target content instance");
VBPlayContentInfo targetInstancePlayInfo;
targetInstancePlayInfo = sll.PlayContentInstanceLoadWithPlayerController(targetInstanceToPlay,
mySession.SessionID);
VBContentInstance targetInstanceRet;
targetInstanceRet = sll.PlayContentLogStart(targetInstanceToPlay.ContentInstance,
mySession.SessionID);
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed");
76
VEMS Mystro API Reference Guide
Syntax:
PlayContentStop(targetActivityLogID, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the PlayContentStop
operation by examining the Exception field.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve content ID of content to play by doing a search based on input from GUI (not shown)
int targetContentID;
VBPlayContentInfo contentPlayInfo;
contentPlayInfo = sll.PlayContentLoadWithPlayerController(targetContentID, mySession.SessionID);
if (contentPlayInfo.Exception != null) throw new Exception("Could not find playback info for
target content");
VBContentInstance playContentResponse;
playContentResponse = sll.PlayContentLogStart(contentPlayInfo.ContentInstance,
mySession.SessionID);
77
VEMS Mystro API Reference Guide
78
VEMS Mystro API Reference Guide
Method 1:
Syntax:
DateTimeGetBestGuessEnumTimeZoneID(utcOffsetInMin, supportsDaylightSvgsTime,
daylightsSavingsTransitionStartMonth, daylightSavingsTransitionEndMonth, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the timeZoneID of the target time zone in its ReturnValue field. This
value is needed when setting up a scheduled event. The Exception field can also be examined to determine if an
error occurred during the DateTimeGetBestGuessEnumTimeZoneID operation.
Method 2:
Syntax:
ScheduleEventContentInfoGet(targetContentID, sessionID)
Inputs:
Output
VBScheduledEventContentInfo object
The VBScheduledEventContentInfo object returned contains information about the content to rebroadcast that the
scheduling module needs. The Exception field should be examined to determine if an error occurred during the
ScheduleEventContentInfoGet operation.
79
VEMS Mystro API Reference Guide
Method 3:
Syntax:
ScheduleEventContentSeedCreateFromContentWithMetadata(targetContentID, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the newly generated content ID for the rebroadcast content event in its
ReturnValue field. The Exception field should be examined to determine if an error occurred during the
ScheduleEventContentSeedCreateFromContentWithMetadata operation.
Method 4:
Syntax:
ContentTitleDescriptionUpdate(targetContentObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned should be examined to determine if an error occurred during the
ContentTitleDescriptionUpdate operation.
Method 5:
Syntax:
80
VEMS Mystro API Reference Guide
Output:
VBList<VBScheduledEventDeviceSTBInfo>
Method 6:
Syntax:
ScheduleEventAdd(scheduledEventObj, sessionID)
Inputs:
The following fields should be set on the scheduledEventObj prior to passing it to the ScheduleEventAdd method:
81
VEMS Mystro API Reference Guide
ScheduledEventSource The object representing the event source. See the VBSchedul
following tables for details. edEventSo
urce
ScheduledEventDestination The list representing all destination STBs that the List<VBSc
List chosen content will play on. This field must be heduledEv
initialized to a new List<VBScheduledEventDestination>() entDestin
prior to use. ation>
The following fields must be set on the VBScheduledEventSource object prior to assigning it to the
ScheduledEventSource field of the scheduledEventObj object:
ScheduledEventID The ID of the scheduled event. This is always set to zero. int
ScheduledEventSourceID The ID of the source of the scheduled event. This is always int
set to zero.
The following fields must be set on the VBScheduledEventDestRecord object prior to assigning it to the
ScheduledEventDestRecord field of the scheduledEventObj object:
82
VEMS Mystro API Reference Guide
The following fields must be set on a VBScheduledEventDestination object prior to adding it to the
ScheduledEventDestinationList field of the scheduledEventObj object:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ScheduleEventAdd operation by examining the Exception field.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table for details");
//retrieve search criteria from GUI and retrieve the desired content with search API call (not shown)
VBContent targetContent;
//UTC time zone offset and daylight savings start/end months (could be hardcoded in config file, etc)
int utcOffsetInMin = -300; //value for eastern United States
int daylightSvgsStartMth = 3; //starts in March
int daylightSvgsEndMth = 11; //ends in November
if (timeZoneData.Exception != null) throw new Exception("Could not get time zone ID");
83
VEMS Mystro API Reference Guide
//retrieve title and description content metadata from GUI (not shown here)
string rebroadcastTitle;
string rebroadcastDesc;
//calculate start and stop times for the rebroadcast (have it start in two minutes)
int targetContentDuration = targetContent.MaxDuration;
DateTime playStartTime = DateTime.Now.AddMinutes(2);
DateTime playStopTime = playStartTime.AddSeconds(targetContentDuration);
//retrieve name and description of the scheduled event from GUI (not shown here)
string eventName;
string eventDesc;
//construct event
VBScheduledEvent newEventToSchedule = new VBScheduledEvent();
newEventToSchedule.ScheduledEventID = 0; //always zero
newEventToSchedule.Description = eventDesc;
newEventToSchedule.Name = eventName;
newEventToSchedule.EnableRecurrence = false; //false if not a recurring event
newEventToSchedule.ShouldDeleteWhenExpired = false;
newEventToSchedule.EnumScheduledEventTypeID = (int)SCHEDULEEVENTTYPE.RebroadcastContent;
newEventToSchedule.EnumScheduledEventCreatedBySourceID =(int)SCHEDULEDEVENTCREATEDBYSOURCE.Scheduler;
newEventToSchedule.EnumTimeZoneID = timeZoneData.ReturnValue;
newEventToSchedule.IsTempEvent = false; //always false
newEventToSchedule.MetadataContentID = rebroadcastContentID.ReturnValue;
//set start/end times and duration (should be as long as the content MaxDuration)
newEventToSchedule.StartDate = playStartTime;
newEventToSchedule.StartDateMonth = playStartTime.Month;
newEventToSchedule.StartDateDay = playStartTime.Day;
newEventToSchedule.StartDateYear = playStartTime.Year;
newEventToSchedule.StartTimeHour = playStartTime.Hour;
newEventToSchedule.StartTimeMinute = playStartTime.Minute;
newEventToSchedule.EndDate = playStopTime;
newEventToSchedule.EndDateMonth = playStopTime.Month;
newEventToSchedule.EndDateDay = playStopTime.Day;
newEventToSchedule.EndDateYear = playStopTime.Year;
newEventToSchedule.EndTimeHour = playStopTime.Hour;
newEventToSchedule.EndTimeMinute = playStopTime.Minute;
newEventToSchedule.RecurrenceScheduleTimeDurationSeconds = targetContentDuration;
84
VEMS Mystro API Reference Guide
if (scheduleEventResponse.Exception != null)
{
throw new Exception("Could not create Rebroadcast Content to STB Scheduled Event");
}
//continue working….
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
85
VEMS Mystro API Reference Guide
Method 1:
Syntax:
DateTimeGetBestGuessEnumTimeZoneID(utcOffsetInMin, supportsDaylightSvgsTime,
daylightsSavingsTransitionStartMonth, daylightSavingsTransitionEndMonth, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the timeZoneID of the target time zone in its ReturnValue field. This
value is needed when setting up a scheduled event. The Exception field can also be examined to determine if an
error occurred during the DateTimeGetBestGuessEnumTimeZoneID operation.
Method 2:
Syntax:
Output:
VBList<VBScheduledEventDeviceSlotInfo>
86
VEMS Mystro API Reference Guide
Method 3:
Syntax:
Output:
VBScheduledEventDeviceSlotInfo object
The VBScheduledEventDeviceSlotInfo object returned contains information about the target slot that is needed by
the VBScheduledEventSource object in the ScheduledEventSource field of the VBScheduledEvent object
representing the live broadcast event. The Exception field should be examined to determine if an error occurred
during the ScheduleEventDeviceSlotInfoGet operation.
Method 4:
ScheduleEventContentSeedCreate(sessionID)
Output:
VBIntData object
The VBIntData object returned contains the content ID of the live broadcast event in its ReturnValue field. The
Exception field should be examined to determine if an error occurred during the
ScheduleEventContentSeedCreate operation.
87
VEMS Mystro API Reference Guide
Method 5:
Syntax:
Output:
VBList<VBScheduledEventDeviceSTBInfo>
Method 6:
Syntax:
ContentTitleDescriptionUpdate(targetContentObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned should be examined to determine if an error occurred during the
ContentTitleDescriptionUpdate operation.
Method 7:
Syntax:
ScheduleEventAdd(scheduledEventObj, sessionID)
88
VEMS Mystro API Reference Guide
Inputs:
The following fields should be set on the scheduledEventObj prior to passing it to the ScheduleEventAdd method:
EnumTimeZoneID The ReturnValue field contained in the object returned from int
DateTimeGetBestGuessEnumTimeZoneID
IsTempEvent Flag indicating whether or not the event is a temporary boolean
event. This is usually false.
MetadataContentID The content ID of the live broadcast event. This is set to int
the value returned from
ScheduleEventContentSeedCreateFromContentWithMetadata
StartDate Object representing the start date of the scheduled event object
StartDateMonth The start date month (January = 1) int
StartDateDay The start date day of the month (1 - 31) int
StartDateYear The start date year int
StartTimeHour The start time hour (0 - 23) int
StartTimeMinute The start time minute (0 - 59) int
EndDate Object representing the end date of the scheduled event object
EndDateMonth The end date month (January = 1) int
EndDateDay The end date day of the month (1 - 31) int
EndDateYear The end date year int
EndTimeHour The end time hour (0 - 23) int
EndTimeMinute The end time minute (0 - 59) int
RecurrenceScheduleTim The duration of the scheduled event, in seconds int
eDurationSeconds
ScheduledEventSource The object representing the event source. See the VBScheduledE
following tables for details. ventSource
ScheduledEventDestina The list representing all destination STBs that the chosen List<VBSched
tionList content will play on. This field must be initialized to a uledEventDes
new List<VBScheduledEventDestination>() prior to use. tination>
89
VEMS Mystro API Reference Guide
The following fields must be set on the VBScheduledEventSource object prior to assigning it to the
ScheduledEventSource field of the scheduledEventObj object:
The following fields must be set on the VBScheduledEventDestRecord object prior to assigning it to the
ScheduledEventDestRecord field of the scheduledEventObj object:
(**Note: This ScheduledEventDestRecord object can be configured to allow the live broadcast to be recorded to
a VBStar while it is playing to the target STBs, see the code example for details.)
The following fields must be set on a VBScheduledEventDestination object prior to adding it to the
ScheduledEventDestinationList field of the scheduledEventObj object:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ScheduleEventAdd operation by examining the Exception field.
90
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table
for details");
//retrieve search criteria from GUI and retrieve the desired content with search API call (not shown)
VBContent targetContent;
//UTC time zone offset and daylight savings start/end months (could be hardcoded in config file, etc)
int utcOffsetInMin = -300; //value for eastern United States
int daylightSvgsStartMth = 3; //starts in March
int daylightSvgsEndMth = 11; //ends in November
if (timeZoneData.Exception != null) throw new Exception("Could not get time zone ID");
//2. Retrieve the available VBrick slots for the live broadcast
List<int> eventSourceTypes = new List<int>();
eventSourceTypes.Add((int)SCHEDULEDEVENTSOURCETYPE.VBrick); //could also be DME, RMD,RMS, or Content
VBList<VBScheduledEventDeviceSlotInfo> allAvailableSlots =
sll.ScheduleEventDeviceSlotsGet(string.Empty, mySession.SessionID, eventSourceTypes);
//3. retrieve info for the desired slot (assume the first slot returned is the target slot for
//simplicity)
VBScheduledEventDeviceSlotInfo targetSlotInfo =
sll.ScheduleEventDeviceSlotInfoGet(allAvailableSlots.Entities[0].DeviceSlotID,
allAvailableSlots.Entities[0].EnumDeviceSlotTypeID, mySession.SessionID);
if (targetSlotInfo.Exception != null) throw new Exception("Could not retrieve target slot info");
//create list of encoding types based on encoding type that the target slot supports
List<int> targetEncodingTypes = new List<int>();
targetEncodingTypes.Add(targetSlotInfo.EnumEncodingTypeID);
//5. Retrieve all STB info
VBList<VBScheduledEventDeviceSTBInfo> allAvailableSTBs =
sll.ScheduleEventDecoderDeviceSTBsGet(targetEncodingTypes, string.Empty, mySession.SessionID);
//retrieve live broadcast title and description from GUI (not shown here)
string liveBroadcastTitle;
string liveBroadcastDescription;
91
VEMS Mystro API Reference Guide
//retrieve the length of broadcast in minutes from GUI (not shown here)
int broadcastInMinutes;
DateTime broadcastStartTime = DateTime.Now;
DateTime broadcastEndTime = DateTime.Now.AddMinutes(broadcastInMinutes);
int durationOfBroadcastInSeconds = broadcastInMinutes * 60;
//retrieve name and description of the scheduled event from GUI (not shown here)
string name;
string description;
//construct event
VBScheduledEvent newEventToSchedule = new VBScheduledEvent();
newEventToSchedule.ScheduledEventID = 0; //always zero
newEventToSchedule.Description = description;
newEventToSchedule.Name = name;
newEventToSchedule.EnableRecurrence = false; //false if not a recurring event.
newEventToSchedule.ShouldDeleteWhenExpired = false;
newEventToSchedule.EnumScheduledEventTypeID = (int)SCHEDULEEVENTTYPE.LiveBroadcast;
newEventToSchedule.EnumScheduledEventCreatedBySourceID =
(int)SCHEDULEDEVENTCREATEDBYSOURCE.Scheduler;
newEventToSchedule.EnumTimeZoneID = timeZoneData.ReturnValue;
newEventToSchedule.IsTempEvent = false; //always false
newEventToSchedule.MetadataContentID = liveBroadcastContentID.ReturnValue;
92
VEMS Mystro API Reference Guide
//Note: set up the destination record as seen in this code block to record the live broadcast to a
//VBStar (It will still be sent to the target STBs). This sample code block assumes that the
//targetSlotInfo is from a VBStar.
//<RecordToVBStar>
newEventToSchedule.ScheduledEventDestRecord = new VBScheduledEventDestRecord();
newEventToSchedule.ScheduledEventDestRecord.ScheduledEventID = 0; //always zero
newEventToSchedule.ScheduledEventDestRecord.ScheduledEventDestRecordID = 0; //always zero
newEventToSchedule.ScheduledEventDestRecord.DeviceVBrickSlotID = targetSlotInfo.DeviceSlotID;
newEventToSchedule.ScheduledEventDestRecord.EnumScheduledEventDestRecordTypeID =
(int)SCHEDULEDEVENTDESTRECORDTYPE.VBrick; //must be VBrick to record to VBStar
newEventToSchedule.ScheduledEventDestRecord.ScheduledEventDestRecordVBrick = new
VBScheduledEventDestRecordVBrick();
newEventToSchedule.ScheduledEventDestRecord.ScheduledEventDestRecordVBrick.DeviceVBrickSlotID =
targetSlotInfo.DeviceSlotID;
newEventToSchedule.ScheduledEventDestRecord.ScheduledEventDestRecordVBrick.ScheduledEventDestRecordID
= 0; //always zero
newEventToSchedule.ScheduledEventDestRecord.ScheduledEventDestRecordVBrick.ShouldFtpAfterRecord =
true; //always true
//</RecordToVBStar>
//Scheduled Event Destination List (let's just add the 1st two STBs for simplicity)
//The developer can cherry pick STBs as needed. Each STB requires its own
//VBScheduledEventDestination object.
//continue working….
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("Could not log out");
93
VEMS Mystro API Reference Guide
Method 1:
Syntax:
DateTimeGetBestGuessEnumTimeZoneID(utcOffsetInMin, supportsDaylightSvgsTime,
daylightsSavingsTransitionStartMonth, daylightSavingsTransitionEndMonth, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the timeZoneID of the target time zone in its ReturnValue field. This
value is needed when setting up a scheduled event. The Exception field can also be examined to determine if an
error occurred during the DateTimeGetBestGuessEnumTimeZoneID operation.
Method 2:
Syntax:
ScheduleEventContentInfoGet(targetContentID, sessionID)
Inputs:
Output
VBScheduledEventContentInfo object
The VBScheduledEventContentInfo object returned contains information about the content to tune in to that the
scheduling module needs. The Exception field should be examined to determine if an error occurred during the
ScheduleEventContentInfoGet operation.
94
VEMS Mystro API Reference Guide
Method 3:
Syntax:
ScheduleEventContentSeedCreateFromContentWithMetadata(targetContentID, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the newly generated content ID for the scheduled event in its
ReturnValue field. The Exception field should be examined to determine if an error occurred during the
ScheduleEventContentSeedCreateFromContentWithMetadata operation.
Method 4:
Syntax:
Output:
VBList<VBScheduledEventDeviceSTBInfo>
Method 5:
Syntax:
ScheduleEventAdd(scheduledEventObj, sessionID)
95
VEMS Mystro API Reference Guide
Inputs:
The following fields should be set on the scheduledEventObj prior to passing it to the ScheduleEventAdd method:
EnumTimeZoneID The ReturnValue field contained in the object returned from int
DateTimeGetBestGuessEnumTimeZoneID
IsTempEvent Flag indicating whether or not the event is a temporary boolean
event. This is usually false.
MetadataContentID Content ID of the Tune STB to Stream event, this is set to int
the ReturnValue field contained in the object returned from
ScheduleEventContentSeedCreateFromContentWithMetadata
StartDate Object representing the start date of the scheduled event object
StartDateMonth The start date month (January = 1) int
StartDateDay The start date day of the month (1 - 31) int
StartDateYear The start date year int
StartTimeHour The start time hour (0 - 23) int
StartTimeMinute The start time minute (0 - 59) int
EndDate Object representing the end date of the scheduled event object
EndDateMonth The end date month (January = 1) int
EndDateDay The end date day of the month (1 - 31) int
EndDateYear The end date year int
EndTimeHour The end time hour (0 - 23) int
EndTimeMinute The end time minute (0 - 59) int
RecurrenceScheduleTim The duration of the scheduled event, in seconds int
eDurationSeconds
ScheduledEventSource The object representing the event source. See the VBScheduledE
following tables for details. ventSource
ScheduledEventDestina The list representing all destination STBs that the chosen List<VBSched
tionList content will play on. This field must be initialized to a uledEventDes
new List<VBScheduledEventDestination>() prior to use. tination>
96
VEMS Mystro API Reference Guide
The following fields must be set on the VBScheduledEventSource object prior to assigning it to the
ScheduledEventSource field of the scheduledEventObj object:
ScheduledEventID The ID of the scheduled event. This is always set to zero. int
ScheduledEventSourceID The ID of the source of the scheduled event. This is int
always set to zero.
The following fields must be set on the VBScheduledEventDestRecord object prior to assigning it to the
ScheduledEventDestRecord field of the scheduledEventObj object:
The following fields must be set on a VBScheduledEventDestination object prior to adding it to the
ScheduledEventDestinationList field of the scheduledEventObj object:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ScheduleEventAdd operation by examining the Exception field.
97
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table
for details");
//retrieve search criteria from GUI and retrieve the desired content with search API call (not shown)
VBContent targetContent;
//UTC time zone offset and daylight savings start/end months (could be hardcoded in config file, etc)
int utcOffsetInMin = -300; //value for eastern United States
int daylightSvgsStartMth = 3; //starts in March
int daylightSvgsEndMth = 11; //ends in November
if (timeZoneData.Exception != null) throw new Exception("Could not get time zone ID");
//retrieve search criteria from GUI, perform search and retrieve target content (not shown here)
VBContent targetContent;
//3. Create Content ID for the 'Tune STB to Existing Stream' event
VBIntData tuneSTBToStreamEventContentID =
sll.ScheduleEventContentSeedCreateFromContentWithMetadata(targetContent.ContentID,
mySession.SessionID);
if (tuneSTBToStreamEventContentID.Exception != null)
{
throw new Exception("Coult not generate ContentID for event");
}
//retrieve length of time for STB to tune in for from the GUI (not shown here)
int numOfMinutesToTuneInFor;
DateTime tuneSTBStart = DateTime.Now;
DateTime tuneSTBEnd = DateTime.Now.AddMinutes(numOfMinutesToTuneInFor);
int durationToTuneInFor = numOfMinutesToTuneInFor * 60; //convert minutes to seconds
//retrieve the name and description of the Tune STB to Existing stream event from GUI (not shown)
string name;
string description;
98
VEMS Mystro API Reference Guide
//construct event
VBScheduledEvent newEventToSchedule = new VBScheduledEvent();
newEventToSchedule.ScheduledEventID = 0; //always zero
newEventToSchedule.Description = description;
newEventToSchedule.Name = name;
newEventToSchedule.EnableRecurrence = false; //false if not a recurring event.
newEventToSchedule.ShouldDeleteWhenExpired = false;
newEventToSchedule.EnumScheduledEventTypeID = (int)SCHEDULEEVENTTYPE.TuneSTB;
newEventToSchedule.EnumScheduledEventCreatedBySourceID =
(int)SCHEDULEDEVENTCREATEDBYSOURCE.Scheduler;
newEventToSchedule.EnumTimeZoneID = timeZoneData.ReturnValue;
newEventToSchedule.IsTempEvent = false; //always false
newEventToSchedule.MetadataContentID = tuneSTBToStreamEventContentID.ReturnValue; //new content ID
//Scheduled Event Destination List (let's just add the 1st two STBs for simplicity)
//build up the Destination object for the 1st STB
VBScheduledEventDestination firstStbDestination = new VBScheduledEventDestination();
firstStbDestination.EnumScheduledEventDestinationTypeID = (int)SCHEDULEDEVENTDESTTYPE.STB;
firstStbDestination.ScheduledEventID = 0; //always zero
firstStbDestination.ScheduledEventDestinationID = 0; //always zero
firstStbDestination.DeviceSTBInfo = allAvailableSTBs.Entities[0];
//build up the Destination object for the 2nd STB
VBScheduledEventDestination secondStbDestination = new VBScheduledEventDestination();
secondStbDestination.EnumScheduledEventDestinationTypeID = (int)SCHEDULEDEVENTDESTTYPE.STB;
secondStbDestination.ScheduledEventID = 0;
secondStbDestination.ScheduledEventDestinationID = 0;
secondStbDestination.DeviceSTBInfo = allAvailableSTBs.Entities[1];
//initialize the destination list
newEventToSchedule.ScheduledEventDestinationList = new List<VBScheduledEventDestination>();
//add the destinations the scheduled event
newEventToSchedule.ScheduledEventDestinationList.Add(firstStbDestination);
newEventToSchedule.ScheduledEventDestinationList.Add(secondStbDestination);
99
VEMS Mystro API Reference Guide
if (scheduleEventResponse.Exception != null)
{
throw new Exception("Could not add Tune STB To Existing Stream event");
}
//continue working….
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("Logout failed");
100
VEMS Mystro API Reference Guide
12 Record Content
The VEMS Mystro API provides the ability to record live content being viewed by the user. Only live content can
be recorded. The recorded subset of the original content is treated just like any other content; it is searchable and
can have metadata associated with it. Note that not all live content can be recorded. Prior to beginning a
recording, a method is used to determine if a unit of content is recordable. After a unit of content has been
verified as recordable, the method used to start a recording is explored, followed by the methods needed to
assign metadata to the recorded content, retrieve the recording status and finally, stop the recording.
101
VEMS Mystro API Reference Guide
Syntax:
CanRecord(targetContentObj, sessionID)
Input:
Output:
VBBoolData object
The VBBoolData object returned allows client code to determine if the target content is recordable by examining
its ReturnValue field. If the ReturnValue field is true, the content is recordable otherwise it is not recordable. The
Exception field should also be examined to determine if an error occurred during the CanRecord operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog
table for details");
//retrieve content to test by doing a search based on input from GUI (not shown)
string targetContentTitle; //from GUI
VBContent targetContent; //populate with search result
if (isTargetContentRecordable.ReturnValue)
{
//content is recordable, take action (start recording)
}
else
{
//content is not recordable
throw new Exception("Content is not recordable");
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed");
102
VEMS Mystro API Reference Guide
Syntax:
Inputs:
Output:
VBRecordInfo object
The VBRecordInfo object returned allows client code to update the metadata associated with the recording by
using the VBRecordRequest object in the Record field. The Exception field should be examined to determine if
an error occurred during the ContentRecordStart operation.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table
for details");
//retrieve content to test by doing a search based on input from GUI (not shown)
string targetContentTitle; //from GUI
VBContent targetContent; //populate with search result
VBRecordInfo contentRecordInfo;
if (isTargetContentRecordable.ReturnValue)
{
//content is recordable
contentRecordInfo = sll.ContentRecordStart(targetContent.ContentID, new VBContent(),
mySession.SessionID);
if (contentRecordInfo.Exception != null) throw new Exception("ContentRecordStart failed");
}
else
{
throw new Exception("Content is not recordable");
}
103
VEMS Mystro API Reference Guide
Method 1:
Syntax:
Inputs:
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ContentRecordUpdateMetadata operation by examining the Exception field.
Method 2:
Syntax:
ContentCategoriesGetAvailableForEdit(targetContentID, sessionID)
Inputs:
Output:
VBList<VBCategory>
The VBList<VBCategory> object returned is a list of VBCategory objects representing all categories that the
invoking user has Add access to. The recorded content may be added to any of these categories. The Exception
field should be examined to determine if an error occurred during the ContentCategoriesGetAvailableForEdit
operation.
104
VEMS Mystro API Reference Guide
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table
for details");
//retrieve content by doing a search based on input from GUI (not shown)
string targetContentTitle; //from GUI
VBContent targetContent; //populate with search result
//start recording
VBRecordInfo contentRecordInfo;
contentRecordInfo = sll.ContentRecordStart(targetContent.ContentID, new VBContent(),
mySession.SessionID);
//get the title, description and name of category to add recorded content to, from GUI (not shown)
string categoryName;
string title;
string description;
//create new category object with just the target category’s ID and Name
VBCategory catForMetadataUpdate = new VBCategory();
catForMetadataUpdate.CategoryID = targetCategory.CategoryID;
catForMetadataUpdate.Name = targetCategory.Name;
105
VEMS Mystro API Reference Guide
Syntax:
ContentRecordStop(targetRecordRequestObj, sessionID)
Inputs:
Output:
VBRequestRecord object
The VBRequestRecord object returned can be used to determine if an error occurred during the
ContentRecordStop operation by examining its Exception field. The RequestID field can also be used when
calling another method to determine the status of the record request.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table
for details");
//retrieve content by doing a search based on input from GUI (not shown)
string targetContentTitle; //from GUI
VBContent targetContent; //populate with search result
//start recording
VBRecordInfo contentRecordInfo;
contentRecordInfo = sll.ContentRecordStart(targetContent.ContentID, new VBContent(),
mySession.SessionID);
//add record content metadata, wait some time until all desired content has been recorded
//stop recording
VBRequestRecord stopRecordingResponse = sll.ContentRecordStop(contentRecordInfo.Record,
mySession.SessionID);
106
VEMS Mystro API Reference Guide
Syntax:
ContentRecordStatusGet(recordRequestID, sessionID)
Inputs:
Output:
VBRequestRecord object
The VBRequestRecord object returned can be used to determine if an error occurred during the
ContentRecordStatusGet operation by examining its Exception field.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed. See the ExceptionLog table
for details");
//start recording
VBRecordInfo contentRecordInfo;
contentRecordInfo = sll.ContentRecordStart(targetContent.ContentID, new VBContent(),
mySession.SessionID);
//add record content metadata, wait some time until all desired content has been recorded
//stop recording
VBRequestRecord stopRecordingResponse = sll.ContentRecordStop(contentRecordInfo.Record,
mySession.SessionID);
//get status of record request and verify that it finished without error
VBRequestRecord finishRecordingResponse =
sll.ContentRecordStatusGet(contentRecordInfo.Record.RequestID, mySession.SessionID);
107
VEMS Mystro API Reference Guide
if (finisheRecordingResponse.PercentDone == 100)
{
//the recording successfully finished
}
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed");
108
VEMS Mystro API Reference Guide
Method 1:
Syntax:
DateTimeGetBestGuessEnumTimeZoneID(utcOffsetInMin, supportsDaylightSvgsTime,
daylightsSavingsTransitionStartMonth, daylightSavingsTransitionEndMonth, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the timeZoneID of the target time zone in its ReturnValue field. This
value is needed when setting up a scheduled event. The Exception field can also be examined to determine if an
error occurred during the DateTimeGetBestGuessEnumTimeZoneID operation.
Method 2:
Syntax:
ScheduleEventContentInfoGet(targetContentID, sessionID)
Inputs:
Output
VBScheduledEventContentInfo object
The VBScheduledEventContentInfo object returned contains information about the content to record that the
scheduling module needs. The Exception field should be examined to determine if an error occurred during the
ScheduleEventContentInfoGet operation.
109
VEMS Mystro API Reference Guide
Method 3:
Syntax:
ScheduleEventContentSeedCreateFromContentWithMetadata(targetContentID, sessionID)
Inputs:
Output:
VBIntData object
The VBIntData object returned contains the newly generated content ID for the Record event in its ReturnValue
field. The Exception field should be examined to determine if an error occurred during the
ScheduleEventContentSeedCreateFromContentWithMetadata operation.
Method 4:
Syntax:
ContentTitleDescriptionUpdate(targetContentObj, sessionID)
Inputs:
Output:
VBVoidData object
The VBVoidData object returned should be examined to determine if an error occurred during the
ContentTitleDescriptionUpdate operation.
Method 5:
Syntax:
ScheduleEventAdd(scheduledEventObj, sessionID)
Inputs:
110
VEMS Mystro API Reference Guide
The following fields should be set on the scheduledEventObj prior to passing it to the ScheduleEventAdd method:
ScheduledEventSource The object representing the event source. See the VBScheduledE
following tables for details. ventSource
111
VEMS Mystro API Reference Guide
The following fields must be set on the VBScheduledEventSource object prior to assigning it to the
ScheduledEventSource field of the scheduledEventObj object:
ScheduledEventID The ID of the scheduled event. This is always set to zero. int
ScheduledEventSourceID The ID of the source of the scheduled event. This is always int
set to zero.
The following fields must be set on the VBScheduledEventDestRecord object prior to assigning it to the
ScheduledEventDestRecord field of the scheduledEventObj object:
DeviceVBrickSlotID The ID of the VBrick slot that the original content int
is streaming out of. This is set to the value of
the ContentSourceDeviceSlotInfo.DeviceSlotID
field contained within the
VBScheduledEventContentInfo object returned from
the ScheduleEventContentInfoGet method
The following fields must be set on the VBScheduledEventDestRecordVBrick object prior to assigning it to the
ScheduledEventDestRecordVBrick field of the scheduledEventObj object:
112
VEMS Mystro API Reference Guide
Output:
VBVoidData object
The VBVoidData object returned allows client code to determine if an error occurred during the
ScheduleEventAdd operation by examining the Exception field.
//login
VBSession mySession = sll.UserLogin(Username, Password, ApplicationID, ClientIP, UserLanguage);
if (mySession.Exception != null) throw new Exception("UserLogin failed");
//retrieve search criteria from GUI and retrieve the desired content with search API call (not shown)
VBContent targetContent;
//get UTC time zone offset and daylight savings start/end months
int utcOffsetInMin = -300; //value for eastern United States
int daylightSvgsStartMth = 3; //starts in March
int daylightSvgsEndMth = 11; //ends in November
if (timeZoneData.Exception != null) throw new Exception("Could not get time zone ID");
//retrieve title and description content metadata from GUI (not shown here)
string recordTitle;
string recordDesc;
113
VEMS Mystro API Reference Guide
//retrieve name and description of the scheduled event from GUI (not shown here)
string eventName;
string eventDesc;
//set start/end times and duration (set it to start now and last for one hour)
newEventToSchedule.StartDate = DateTime.Now;
newEventToSchedule.StartDateMonth = DateTime.Now.Month;
newEventToSchedule.StartDateDay = DateTime.Now.Day;
newEventToSchedule.StartDateYear = DateTime.Now.Year;
newEventToSchedule.StartTimeHour = DateTime.Now.Hour;
newEventToSchedule.StartTimeMinute = DateTime.Now.Minute;
newEventToSchedule.EndDate = DateTime.Now.AddHours(1);
newEventToSchedule.EndDateMonth = DateTime.Now.AddHours(1).Month;
newEventToSchedule.EndDateDay = DateTime.Now.AddHours(1).Day;
newEventToSchedule.EndDateYear = DateTime.Now.AddHours(1).Year;
newEventToSchedule.EndTimeHour = DateTime.Now.AddHours(1).Hour;
newEventToSchedule.EndTimeMinute = DateTime.Now.AddHours(1).Minute;
newEventToSchedule.RecurrenceScheduleTimeDurationSeconds = 3600; //duration of the event (1 hour)
114
VEMS Mystro API Reference Guide
//logout
VBVoidData logOutResponse = sll.UserLogout(mySession.SessionID);
if (logOutResponse.Exception != null) throw new Exception("UserLogout failed");
115
VEMS Mystro API Reference Guide
116
VEMS Mystro API Reference Guide
Template 1:
Syntax:
Inputs:
Now the developer can take the generated iframe element and embed it inside of another web page:
<html>
<head>
<title>Embedded Video Content Test</title>
</head>
<body>
<iframe class='embedPlayer' type='text/html'
src='http://172.22.2.217/VEMSWeb/Widgets/EmbedPlayerControllerWidget.html?contentID=31'
width='600' height='400' frameborder='0' />
</body>
</html>
117
VEMS Mystro API Reference Guide
Template 2:
Syntax:
Inputs:
Now the developer can take the generated iframe element and embed it inside of another web page:
<html>
<head>
<title>Embedded Video Clip Content Test</title>
</head>
<body>
<iframe class='embedPlayer' type='text/html'
src='http://172.22.2.217/VEMSWeb/Widgets/EmbedPlayerControllerWidget.html?contentID=31&
clipContentID=25' width='600' height='400' frameborder='0' />
</body>
</html>
118
VEMS Mystro API Reference Guide
Template 1:
Syntax:
<protocol><serverHost>/VEMSWeb/VEMSHost.html?VBTemplate=Templates/VideoInfoTemplate.xml&contentID=
<targetContentID>&shared=1
Inputs:
http://172.22.2.217/VEMSWeb/VEMSHost.html?VBTemplate=Templates/VideoInfoTemplate.xml&contentID=787&sh
ared=1
Template 2:
Syntax:
<protocol><serverHost>/VEMSWeb/VEMSHost.html?VBTemplate=Templates/ClipVideoInfoTemplate.xml&contentID
=<targetContentID>&clipContentID=<clipContentID>&shared=1;
Inputs:
http://172.22.2.217/VEMSWeb/VEMSHost.html?VBTemplate=Templates/ClipVideoInfoTemplate.xml&contentID=29
8&clipContentID=2447&shared=1
**Please note that the difference between the two Share templates is the template file being used. The regular
video content template uses VideoInfoTemplate.xml while the video clip template uses the
ClipVideoInfoTemplate.xml.
119
VBrick Systems, Inc.
2121 Cooperative Way, Suite 100
Herndon, VA 20171