VIDIZMO Web API is the 3rd form of API available by VIDIZMO. It uses simple HTTP ‘Get’ or ‘Post’ methods to perform various operations and provides maximum control over its usage among the 3 APIs available. Web API can be called using any technology and language that supports HTTP Get and Post methods.


Like rest of the API, Web APIs also have to be called in Channel or Account context, determined by the domain part of URL where HTTP Get or Post methods are made. To get user specific data or in other words to establish User Context, Developer can use same VIDIZMO JS ‘Login’ API if the calling application is a web client or can call VIDIZMO Web ‘Login’ API as shown in the example below. In the later case, the object returned contains "access_token", which will have to be passed as the parameter to subsequent calls to Web API.

 

Sample Code

   

using System;
using System.IO;
using System.Net;

namespace VidizmoWebAPITestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var loginId = "";
            var encodedPassword = ""; // Base64 html encoded String
            var loginUrl = "http://video.lexcorpinc.com/Handlers/SignInHandler.ashx?loginId=" + loginId + "&password=" + encodedPassword + "&et=cea-10&response_format=json";

            var loginRequest = (HttpWebRequest)WebRequest.Create(loginUrl);

            var access_token = String.Empty;

            using (var loginResponse = (HttpWebResponse)loginRequest.GetResponse())
            {
                if (loginRequest.HaveResponse)
                {
                    if (loginResponse.StatusCode == HttpStatusCode.Created || loginResponse.StatusCode == HttpStatusCode.OK)
                    {
                        using (var loginResponseStream = loginResponse.GetResponseStream())
                        {
                            if (loginResponseStream != null)
                            {
                                using (var loginStreamReader = new StreamReader(loginResponseStream))
                                {
                                    var jsonResponse = loginStreamReader.ReadToEnd();
                                    // Get access_token variable from JSON Response.                                    

                                    loginStreamReader.Close();
                                }
                                loginResponseStream.Flush();
                                loginResponseStream.Close();
                                loginResponseStream.Dispose();
                            }
                        }
                    }

                    loginResponse.Close();
                }
            }
            
            var getFeaturedVideosUrl = "http://video.lexcorpinc.com/Handlers/MashupHandler.ashx?action=search_mashups&is_featured=true&access_token=" + access_token; 

            var featuredVideosRequest = (HttpWebRequest)WebRequest.Create(getFeaturedVideosUrl);

            using (var featuredVideosResponse = (HttpWebResponse)featuredVideosRequest.GetResponse())
            {
                if (featuredVideosRequest.HaveResponse)
                {
                    if (featuredVideosResponse.StatusCode == HttpStatusCode.Created || featuredVideosResponse.StatusCode == HttpStatusCode.OK)
                    {
                        using (var featuredVideoResponseStream = featuredVideosResponse.GetResponseStream())
                        {
                            if (featuredVideoResponseStream != null)
                            {
                                using (var featuredVideoStreamReader = new StreamReader(featuredVideoResponseStream))
                                {
                                    var featuredVideos_JSON = featuredVideoStreamReader.ReadToEnd();                                     

                                    featuredVideoStreamReader.Close();
                                }
                                featuredVideoResponseStream.Flush();
                                featuredVideoResponseStream.Close();
                                featuredVideoResponseStream.Dispose();
                            }
                        }
                    }

                    featuredVideosResponse.Close();
                }
            }
        }
    }
} 

 

This only provides URL for every Web API call and parameters to pass. It does not contain code samples to use. Please use the sample code provided above and replace URL and add parameters to get desired results.


Please note that like every Account, all channels have domains of their own. So if Web API is called using the domain of a channel instead, the Context set would be of the Channel and not Account. Therefore in such case Web, API call for listing Channels will only display one Channel only.


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