Office 365 Video REST API – Create a channel overview

24 Dec

Microsoft exposes almost everything through REST API’s these days, which is excellent!

Not only Mail, Contacts, Calendar and Files, but also Video. In this post I’m going to show you some simple steps to interact with Channels using the REST Video API. But first some basics.

Video Portal basics

The Video Portal exists of a video hub, channels and video’s.
The hub functions as a sort of root, which it isn’t hierarchically speaking. The hub shows all the channels, trending video’s and other stuff you can configure in the Portal Settings section to show eg video’s from a certain channel and some spotlight video’s.
Video - hub

From the hub a single channel can be accessed through the Channels overview. When a single channel is selected the button Channel Settings is available when you have enough permissions. Here items like channel name, color, permissions etc can be configured.
Video - channel settings

A nice feature is the link to Storage Metrics. It displays the allocation of quota within the site.
Video - storage metrics

Channel basics

The hub and channels are all separate site collections. The hub and the default Community channel are visible in the SharePoint admin center, including the storage used, storage limit, etc as shown in the picture below.
Video - admin center

User created channels, site collections, are hidden in de SharePoint admin center. These site collections are perfectly fine accessible by their url. For example a channel named MyChannel was created. The server relative url would then be /portals/MyChannel.

The site collection is used to store video’s, settings and permissions.

A library called Videos stores all the original video’s uploaded into the channel. Also the thumbnail generated after processing the video by Azure Media Services is stored in this list and other metadata about the video. A video is based on a content type called Cloud Video. Besides the ‘regular’  columns as Title and Description other columns are present:

  • Owner
  • People in Video
  • Categories – managed metadata, can be set to a term set of your choice.
  • Thumbnail preview
  • Length (seconds)
  • Frame width
  • Frame height

Since the video is stored in SharePoint the video file size limit is the same as SharePoint file size limit.

Another important list is the Channel Settings list. In this list the channel name, tile color and spotlight videos are stored.

Permissions are just some regular SharePoint groups. The link to the groups isn’t present from the Settings page, but it’s accessible: /_layouts/15/groups.aspx
Video - groups

The groups Creators, Contributors and Viewers are the groups meant in the channel settings accessible from the hub at the Permissions tab: Owners, Editors and Viewers.

Now you have a basic understanding of the hub and the channels, let’s do some code.

Some code

At the hub level a list of channels is available, but it’s only a list of the channel name and the color, no other information is shown here.

Let’s show the users in the permission groups set at the channels next to the channel so a more informative overview is created.

This is a simple example of using the Video REST API and the SharePoint REST API. The Video REST API is used to get information about the video portal and the channels, the SharePoint REST API is used to get the users of some groups.

First a request has to be created to the Video portal’s discovery endpoint to discover whether the video portal is set up and enabled and to get the URL of the video portal.

https://…sharepoint.com/_api/VideoService.Discover

The Video portal root url is used in subsequent calls.

There are two options to get a list of channels. /_api/VideoService/CanEditChannels can be used to get channels he user has Owner or Editor permissions and /_api/VideoService/Channels can be used to get channels the user can view.
Video - response calling channel

The picture above shows the response of the call.

These are the only calls needed to the Video REST API. To request the users in the specified groups the SharePoint REST API can be used like:

https://<channelurl>/_api/web/sitegroups/getbyname(‘<name of the group>’)/users

And the users in the group are returned.

Possible result can be like the image below.
Video - channel overview and users in groups

Summary

In this post the basics about the video portal and channels are explained.

The above overview was just a quick demo with a small amount of channels. Production code should probably contain code more based on search.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.