API Update for Ensemble Video Version 3.4

From Wiki
Jump to: navigation, search

API Update for Ensemble Video Version 3.4


API Demo Account


You can try the new API on https://cloud-test.ensembleVideo.com User: apiDemo Pass: demo123 The API demo account is a system account and has access to all the data in the system

User with Limited Access: User: hasp Pass: hasp The "hasp" account is a contributor in a single library and a viewer in different organization


API Settings


There are three settings that can be configured for the API. RequireSSL: Is SSL connection required to call the API. Default is false. DefaultPageIndex: The default current page index. Default is 1. DefaultPageSize: The default number of items per page. Default is 10.

You can find these in the API web.config file under the "appSettings" node. The defaults look like so: <add key="RequireSSL" value="false" /> <add key="DefaultPageIndex" value="1" /> <add key="DefaultPageSize" value="10" />


API Context


The API is context specific. That means that it only lists information that the logged in user has access to. Such as organizations or libraries the user has access to.


Security and Authentication


SSL: The API can be configured to required an SSL connection or not.

User Accounts: The API supports basic authentication that is tied to your Ensemble Video account.


Organizations


Organization list is only available to organization or system administrators.

Url: {ensembleWebAppUrl}/api/Organizations Example: https://cloud-test.ensemblevideo.com/api/Organizations


Libraries


The library list is available to any user that can login to the system.

Url: {ensembleWebAppUrl}/api/Libraries Example: https://cloud-test.ensemblevideo.com/api/Libraries


Playlists


The list of playlists is available to any user with at least an editor role.

Url: {ensembleWebAppUrl}/api/Playlists Example: https://cloud-test.ensemblevideo.com/api/Playlists


Media Workflows


The list of media workflows is available to any user with at least an editor role. This list currently includes only media workflows that accept uploaded content.

Url: {ensembleWebAppUrl}/api/MediaWorkflows Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows

Uploading through the media workflow API is documented in more details at: https://docs.google.com/document/d/1e7JxpSDxK52VDbcgzJdwIZHchhtOw1IUsRO6Jq37cCo/edit


Content


The list of content is available to any user that can login to the system.

Url: {ensembleWebAppUrl}/api/Content Example: https://cloud-test.ensemblevideo.com/api/Content


Shared Content


The list of shared content is available to any user that can login to the system.

Url: {ensembleWebAppUrl}/api/SharedContent Example: https://cloud-test.ensemblevideo.com/api/SharedContent


Filtering


Users: If your account has system administrator access, you can filter by a user: Url: {ensembleWebAppUrl}/api/MediaWorkflows?user=hasp Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows?User=hasp

Filter is accomplished by specifying "FilterOn" and "FilterValue" The rule is that whatever column the API returns, you can filter on it.

The only exception is the content and shared content list. For those, you only need to specify "FilterValue" and the API will look for the value in each field of the content data.

// Only show the media work flows called "Progressive (No Transcoding)" Url: {ensembleWebAppUrl}/api/MediaWorkflows?FilterOn=Name&FilterValue=Progressive%20Upload%20-%20System Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows?FilterOn=Name&FilterValue=Progressive%20(No%20Transcoding) // Only show the media work flows for the library called "33 Library" Url: {ensembleWebAppUrl}/api/MediaWorkflows?FilterOn=LibraryName&FilterValue=33%20Library Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows?FilterOn=LibraryName&FilterValue=33%20Library // Only show the media work flows by in the library with ID "f2e41d0a-c89f-4699-9072-27c60cb731c7" Url: {ensembleWebAppUrl}/api/MediaWorkflows?FilterOn=LibraryID&FilterValue=f2e41d0a-c89f-4699-9072-27c60cb731c7 Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows?FilterOn=LibraryID&FilterValue=f2e41d0a-c89f-4699-9072-27c60cb731c7


Paging


The paging parameters are: PageIndex: The number of the current page. Default is whatever you sett in the API settings in the web.config. PageSize: The number of items to return per page. Default is whatever you sett in the API settings in the web.config.

// Display only the first page of the media work flows list with one item per page Url: {ensembleWebAppUrl}/api/MediaWorkflows?PageIndex=1&PageSize=1 Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows?PageIndex=1&PageSize=1


Combining Filtering and Paging


// Only show the media work flows for the library called "33 Library," but with only one item per page, and only the first page Url: {ensembleWebAppUrl}/api/MediaWorkflows?FilterOn=LibraryName&FilterValue=33%20Library&PageIndex=1&PageSize=1 Example: https://cloud-test.ensemblevideo.com/api/MediaWorkflows?FilterOn=LibraryName&FilterValue=33%20Library&PageIndex=1&PageSize=1


Example API Call (JavaScript)


<script src="/api/Scripts/jquery-1.8.2.js" type="text/javascript"></script> <script src="/api/Scripts/jquery.base64.js" type="text/javascript"></script> <script type="text/javascript">

   $(document).ready(function () {
       // Get the user and password from the form values
       var user = $("input#user").val();
       var password = $("input#password").val();
       // Make the call to the server
       // to get a list of libraries
       jQuery.ajax({
           type: "GET",
           url: "https://cloud-test.ensembleVideo.com/api/Libraries",
           dataType: 'jsonp',
           crossDomain: true,
           beforeSend: function(xhr){
               xhr.setRequestHeader('Authorization', 'Basic ' + jQuery.base64.encode(user + ':' + password));
           },
           success: function(apiData) {
               // On success, 'apiData.Data' contains a list of libraries
               $.each(apiData.Data, function (index) {
                   var library = apiData.Data[index];
                   // Format the text to display
                   var str = 'ID: ' + library.ID + ', Name: ' + library.Name + ', Organization: ' + library.OrganizationName;
                   // Add a list item for the library.
$('
  • ', { text: str }).appendTo($('#libraries')); }); } }); }); </script>