Site Feedback Thread

12 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

Is there some kind of API that can be used to access the data on Channel 9

Back to Forum: Site Feedback
  • User profile image
    jlo2

    I would like to be able to build an app around channel 9 contents. The RSS feed for build 2014 is a good place to start, but the web page seems to have the ability to organize content by day and other values that is not present in the feed. Is there some kind of API that can be used to access the data on page:

    http://channel9.msdn.com/Events/Build/2014

  • User profile image
    Cara9

    @jlo2: That's great that you're building an app around Channel 9 content, we'd love to hear about it once you're done.

    We do have another API that we use for our Windows 8 app as well as the newly built (but not yet released) Xbox One app and that is our oData API. I would consider it still in beta but we are betting on it, using it ourselves and improving it all the time. It doesn't quite support all of the oData functionality that you might be expecting. Part of that is intentional, part of that is that we just haven't needed it yet so feel free to let us know if there is something you would like to do or think you ought to be able to do and can't.

    Here is a quick run down of some common queries you might need:

    Metadata
    channel9.msdn.com/odata/$metadata

    Homepage featured items
    channel9.msdn.com/odata/Featured or
    channel9.msdn.com/odata/Featured?$expand=Channel9.ODataModel.Entry/Area,Channel9.ODataModel.Session/Event

    Events
    channel9.msdn.com/odata/Events

    Single Event
    channel9.msdn.com/odata/Events(guid'71be9b53-f608-4c95-a671-9fa901798c11')

    Sessions within an Event
    channel9.msdn.com/odata/Events(guid'71be9b53-f608-4c95-a671-9fa901798c11')/Sessions

    Single Session
    channel9.msdn.com/odata/Sessions(guid'e912f9e6-f2de-405a-b910-9e790130fc6b')

    Entries are similar to Sessions, just substitute Entries for Sessions and Area for Event.

    All results are paged with 25 maximum results. If there are more pages, there will be a nextLink included in the results.

  • User profile image
    Sampy

    One thing I will add: Don't use the "Add Service Reference" feature of VS to call this API. Everyone who has done that has run in to lots of problems. Just treat it as a JSON REST API that puts $ in front of a few query string parameters and you'll be fine. It is locked down pretty tight when it comes to the queries you can do. Basically if a page on the site can't do it, the API can't do it.

  • User profile image
    jlo2

    @Cara9:I have been able to successfully call this API as OData using a  VS Service reference. However, now that I am ready to apply filters to the data data, I am having issues. I have retrieved all sessions for the build 2014 event. But I would like to filter this by Day. The data does not have a reliable date. Is there a way to filter by date during the request using Rest or whatever.

    I have to admit, having used SOAP and REST and now ODATA, I cannot see why anyone would want REST except for ridiculously high volumes of data - its a real pain to work with. I am still working on just getting reliable data for this simple, stupid little app, with SOAP using a properly defined interface is obvious and foolproof.

  • User profile image
    jlo2

    (had to replace 'h t t p', or it thinks pose is spam:{ )

    The REST api output seems consistent with the odata service output. I can't complain, you just need to code using the Skip keyword (I don't think the API is supposed to return an error when you reach the last page):

    while (true)
    {
    try
    {
    var sessions = service.Sessions.Where(w => w.Event.ID == id).Skip(sessionlist.Count());

    foreach (var session in sessions)
    {sessionlist.Add(session);}
    }
    catch (Exception)
    {break;}
    }

    Using REST API:

    channel9.msdn.com/odata/Events(guid'8ab049e2-95f3-42e8-9bf0-a2b90185598e')/Sessions

    returns items like:

    {

    "ID":"bd8eb599-fbcf-4392-921f-a303015f51d9","HasVideo":true,"CurrentRating":null,"InQueue":null,"LastViewedPosition":null,"FarthestViewedPosition":null,"CommentCount":0,"Code":"9-000 ","SessionType":null,"Level":null,"Track":null,"InternalGroup":null,"Title":"Day 2 Channel 9 Open","Description":"<p>Day 2 Channel 9 Open</p>","Room":null,"Attendance":0,"LastUpdated":"2014-04-10T16:52:25.91Z","Starts":null,"Ends":null,"VideoPlayerPreviewImage":"hxxp://media.ch9.ms/ch9/7347/48934fa8-4084-48eb-9276-340ac1e77347/C9Live9000_Custom.jpg","FeaturedImage":"hxxp://media.ch9.ms/ch9/7347/48934fa8-4084-48eb-9276-340ac1e77347/C9Live9000_512.jpg","Thumbnail":"hxxp://media.ch9.ms/ch9/7347/48934fa8-4084-48eb-9276-340ac1e77347/C9Live9000_220.jpg","Slides":null,"ZipFile":null,"VideoMP4High":"hxxp://media.ch9.ms/ch9/7347/48934fa8-4084-48eb-9276-340ac1e77347/C9Live9000_high.mp4","VideoMP4Medium":"hxxp://media.ch9.ms/ch9/7347/48934fa8-4084-48eb-9276-340ac1e77347/C9Live9000_mid.mp4","VideoMP4Low":"hxxp://media.ch9.ms/ch9/7347/48934fa8-4084-48eb-9276-340ac1e77347/C9Live9000.mp4","VideoWMVHQ":null,"VideoWMV":null,"VideoSmooth":null,"VideoProgress":null,"Views":659,"ViewsThisMonth":659,"ViewsThisWeek":190,"Rating":0.0,"RatingCount":0,"Permalink":"http://channel9.msdn.com/Events/Build/2014/9-000","MediaLengthInSeconds":648.0,"Captions":[],"PublishedDate":"2014-04-10T16:52:25.9027072Z"}

    I am interested in grouping events by day and other capabilities of the web page. Notice that the dates of this entry are not very usefull for that AND there is no other value I see to perform that grouping. So what is the secret of calling this API ? Is it documented anywhere ?

     

  • User profile image
    jlo2

    @Cara9:Also tags and comment are missing. This information is in the RSS feed xml document. How can I get it in the API ?

  • User profile image
    Duncanma

    @jlo2: Those *are* the values of the start/end dates for that session though. It was not part of the schedule, so no start/end dates were specified in our system. The same is true for a ton of other sessions that are pre-recorded and didn't happen at a specific date/time. I would suggest you could group everything without a start date into an 'unspecified' or 'no date' group, then group the rest by "April 9th, 2014", "April 10th, 2014", etc... pulling from the Start value.

    As far as documentation, this thread is it at the moment. The API exists to be called by our apps, the majority of which are written by @Cara9, so that means a couple of things

    1. if there are any code snippets or examples, she'd be the one to provide them
    2. if the app doesn't use a type of data (comments for example), then they may not be in the API at all at this point

    Having said that... explain what you need and I'm sure we'll take a look at what we can do in the near term.

  • User profile image
    jlo2

    On the link: h t t p://channel9.msdn.com/Events/Build/2014, we can search by Tag, Speaker, Level and Day. Using the odata service, the Captions, Comments,  Speakers, Tags collections are empty making it  impossible to filter like the web page.

    The RSS feed has the info that appears to be speaker, and categories.

    If you could modify the odata service to fill in the missing elements it would be very helpful for my app.

     

     

  • User profile image
    jlo2

    @Sampy:I have found the odata service is not consistent with the RSS feed, but it works reliably for me.  I suspect the problems you describe with the VS service are because the VS Service must be updated periodically as the odata service changes.

  • User profile image
    Cara9

    @jlo2: You can use the $expand function to get Tags, Speakers (on Sessions) and Authors (on Entries). If you are doing the expand and the Speakers or Tags collections are still empty, that means they don't have any. Level should be coming in on every Session if there are any, otherwise it should be null. It doesn't look like we have Day in the odata API currently but I can look at adding that. Captions will appear only when you are accessing the Entry or Session directly (the collection will be null in a list of Entries or Sessions). I'll look into Comments. Sessions and Entries have a property called CommentCount on them but expanding on Comments doesn't seem to work. I don't currently use Comments in any of the apps I've been working on so I'm not sure if the API supports that yet.

    Session using $expand on Tags (notice Captions also appear)
    channel9.msdn.com/odata/Sessions(guid'f8a9732a-b490-4882-ad1e-a30000fec7e2')?$expand=Tags

    Session using $expand on Tags and Speakers
    channel9.msdn.com/odata/Sessions(guid'f8a9732a-b490-4882-ad1e-a30000fec7e2')?$expand=Tags,Speakers

    Entry using $expand on Tags and Authors
    channel9.msdn.com/odata/Entries(guid'1a87a2ae-52ab-4be4-b0fe-a32201146314')?$expand=Tags,Authors

  • User profile image
    jlo2

    @Cara9:This uses the $expand on the odata service !!

    Here is my code:

    old:

    var sessions = service.Sessions.Where(w => w.Event.ID == id ).Skip(sessionlist.Count());

    new:

    var sessions = service.Sessions.Expand("Speakers,Tags").Where(w => w.Event.ID == id).Skip(sessionlist.Count());

    foreach (var session in sessions)

    {

    sessionlist.Add(session);

    }

     

     

  • User profile image
    Sampy

    The problem is the URL that your calls are generating looks something like this:

    channel9.msdn.com/odata/Sessions?$filter=Event.ID%20eq%20guid'...'&$expand=Speakers,Tags

    This will not work and is one of the reasons I advised against using a VS service reference. You can't pass a filter clause to the Sessions collection like that. What you need to do is use a URL like Cara listed in her examples where it ends with /Sessions(guid'...')?...

    I am not sure if you can make the generated client library issue these sorts of calls and if you can, I don't know how to do it. I recommend using the WebAPI client libraries (which you can get via NuGet) and their HttpClient class (not the one that ships with the framework) to make the calls and build URLs directly.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.