Medium Feed


Friday, March 13, 2015

How to find a Channel ID in YouTube

If we wants to make an API request to get all the videos in the  particular Youtube channel, first we should have to collect the Channel ID for the channels which we are going to process in the API request.

Here is the simple step to get the Channel ID of a YouTube channel
> Go to the particular channel in You tube
> Click on view source from the browser
> Search for the embedded tag "data-channel-external-id" , this will gives the Channel ID.

Monday, March 9, 2015

Cross Domain API request using AJAX and JQuery

We often get into a requirement to read or post a data to an third party cross domain server through their exposed API’s.  We have plenty of straightforward options if we do it from the server side coding, but in the case of doing it from a client call we may get into “cross domain not allowed” error thrown by all browsers.

Here, will show you the one of the cross domain call approach using “JSONP”.

In this example I’m making GET request to Bright cove api  and getting response as JSONP:

NOTE: Using JSONP only we can do GET requests. POST requests is not possible.

<script src=""></script>
(function() {
  var mediaAPI = "";
  $.getJSON( mediaAPI, {
    command: "search_videos",
    video_fields: "videoStillURL,thumbnailURL,id,name",
    media_delivery: "http",
    token: "ZY4Ls9Hq6LCBgleGDTaFRDL..............",
    format: "jsonp"
  .done(function( data,status ) {
 $.each(data, function(i, field){



Tuesday, March 3, 2015

JSON to XML conversion : Error "This document already has a ' DocumentElement ' node"

 Today I had faced an  error while converting JSON string into an XML document object using Jsonconvert.

Here is the code snippet

        FacebookClient fbclient = new FacebookClient();
        JObject objFeeb = JObject.Parse(@" " + fbclient.Get("me/feed") + " ");
        XmlDocument doc = JsonConvert.DeserializeXmlNode(objFeeb.ToString());

When I run the above code I was getting an error as  "This document already has a ' DocumentElement ' node"

To fix the issue, I  just have defined the root element of XML doc and it worked !!

Here is the working code.

  XmlDocument doc = JsonConvert.DeserializeXmlNode(objFeeb.ToString(), "FacebookFeed");