Add licenses API allows users to edit a license against a published content from a Channel or main Account. To use this API, a user must be logged in and therefore User Context established.
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: 36224, mashup_id: 176571, license_type: 2, //Free max_allowed_views: 100, 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=edit_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 |
id |
Id of a license |
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": 36224, "license_durations": [ { "ClientOffSet": 5, "EndDate": "2114-05-15T14:23:02.867Z", "FromDate": "2015-05-16T14:23:02.867Z" } ], "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": 100, "send_notification": null, "triggered_by": 305055 } ], "status": 1, "status_code": 200, "message": null }