Add License API allows users to add a license to a published video from a Channel or a main Account. This type of license allows administrators to set permissions such as the number views allowed for a content, the number of users allowed to view content, content availability etc. 

To use this API, a user must be logged in and therefore User Context established. This parameter can be used with other optional parameters to get the required result set. Some of the parameters are given in the table below.


To set User Context, either use VIDIZMO JS Login API before calling this method or use VIDIZMO Web Login method and additionally pass "access_token" parameter to this call API.


Sample Code

 

<script type="text/javascript">

var licenses = [];

var todayDate = new Date();

var avilable_date = new Date(new Date().getTime() + 24 * 60 * 60 * 1000);
  
var license ={
               id: 0,
               mashup_id: 176571,
               license_type: 2, //Free
               max_allowed_views: -1,
               triggered_by: UserID,
               license_durations:[{
               ClientOffSet: parseFloat(((todayDate.getTimezoneOffset() * -1) / 60.0)),
               EndDate: new Date(todayDate.setFullYear(todayDate.getFullYear() + 99)).toJSON(),
               FromDate: avilable_date
                                }],
                            licensed_users: []
                        };

licenses.push(license)
licenses[0].licensed_users.push({UserId: UserID })
                                 
 var mashupHandler = "http://video.lexcorpinc.com/Handlers/MashupHandler.ashx";
 var queryString = "?action=add_licenses&suppress_response_codes=true";
 queryString += "&access_token=AccessToken";
  
$.ajax(
        {
          type: "Post",
          url: mashupHandler + queryString,
          dataType: 'json',
          data: JSON.stringify(licenses),
          success: function (data) {},
             error: function (req, type, ex) {}
        });

</script>



Properties


Property

Comments

mashup_id 

Id of a content against which user want to add a license.

mashup_session_id

Id of mashup session id in case of live mashup

triggered_by

User id of the owner, creating license

max_allowed_views

Maximum number of views

license_type

Type of a license

 

Preffered Value :

Paid = 1

Free = 2

Custom = 3

license_durations

// Client Offset

ClientOffSet

 

// End Date of a License 

EndDate

 

// Start Date of a License

FromDate

 

licensed_users

// email address of a user

// In case when user not part of Vidizmo

email_address

 

// id of a group

// In case when user want to assign license to a group.

group_id 

 

// user id of the viewer to assign license

user_id

aquisition_detail

// Maximum number of users to assign license

number_Of_users

 

// price of license

price

 

// user id of the viewer to assign license

user_id



Response

 

{
  "video_url": null,
  "video_id": null,
  "video_id_hash": null,
  "tracking_id": null,
  "tracking_id_hash": null,
  "content_id": null,
  "video_status_id": 0,
  "result": [
    {
      "aquisition_detail": null,
      "id": 36226,
      "license_durations": [
        {
          "ClientOffSet": 5,
          "EndDate": "2114-05-15T13:12:51.08Z",
          "FromDate": "2015-05-16T13:12:51.08Z"
        }
      ],
      "licensed_users": [
        {
          "EmailAddress": null,
          "FirstName": null,
          "GroupId": null,
          "GroupName": null,
          "LastName": null,
          "NotifyUser": null,
          "UserId": 305066,
          "TenantId": null
        }
      ],
      "license_type": 2,
      "mashup_id": 176571,
      "mashup_session_id": null,
      "max_allowed_views": -1,
      "send_notification": null,
      "triggered_by": 305055
    }
  ],
  "status": 1,
  "status_code": 200,
  "message": null
}




To learn more how these Widgets work, click here on VIDIZMO Web API Library.

For a complete list of VIDIZMO APIs, click here on VIDIZMO Developer APIs.