Search videos using the Office 365 Video REST API

Office 365 is an awesome solution to share videos in a dedicated portal, organized in different channels. Channels are used (for example) to split videos by themes or categories.

But if you create a lot of channels in your organization or if you have a lot of videos in each channel, it may be pretty difficult to find relevant videos.

If you want to create an application on top of Office 365 Video, it’s interesting to know that the REST API exposes capabilities to search videos, globally at the service level, or at the channel level.

Build and submit search queries

When you want to use the Office 365 Video REST API, you have to submit requests to the endpoint which is only accessible through the portal URL as you can see below.

As we previously said, this endpoint exposes search capabilities at two different levels :

  • Video Service (across all channels)
  • Channel

Depending on which level you want to search videos, you have to build requests by appending path components as you can see below :

Across all channels

On a specific channel'01234567-abcd-cded-1234-1234567890ab')/Search/Query

Add parameters to the querystring to specify search criterias

To retrieve only information that you want, you have to add some parameters to the querystring. Three possibilites are offered to you :

  • querytext
  • startItemIndex
  • itemLimit

As you can imagine, the most important parameter is querytext which allows you to make fulltext searches. startItemIndex and itemLimit are used to perform paging operations.

For example if you want to search the first 10 videos which contains the ‘Awesome’ word, across all channels, your request should look something like that :'Awesome'&itemLimit=10

In the same manner, if you want to retrieve the same videos on a specific channel, your query should look something like that :'01234567-abcd-cded-1234-1234567890ab')/Search/Query?querytext='Awesome'&itemLimit=10

By querying those URLs, you will retrieve a list of videos. Each video is described by the following structure :

<category term="SP.Publishing.VideoItem" scheme="" />
<link rel="edit" href="VideoService/Channels(guid'01234567-abcd-cded-1234-1234567890ab')/Videos(guid'01234567-abcd-cded-1234-1234567890ab')" />
<link rel="" type="application/atom+xml;type=entry" title="Author" href="VideoService/Channels(guid'01234567-abcd-cded-1234-1234567890ab')/Videos(guid'01234567-abcd-cded-1234-1234567890ab')/Author" />
<link rel="" type="application/atom+xml;type=entry" title="Owner" href="VideoService/Channels(guid'01234567-abcd-cded-1234-1234567890ab')/Videos(guid'01234567-abcd-cded-1234-1234567890ab')/Owner" />
<link rel="" type="application/atom+xml;type=feed" title="PeopleInMedia" href="VideoService/Channels(guid'01234567-abcd-cded-1234-1234567890ab')/Videos(guid'01234567-abcd-cded-1234-1234567890ab')/PeopleInMedia" />
<title />
  <name />
<content type="application/xml">
    <d:ChannelID m:type="Edm.Guid">01234567-abcd-cded-1234-1234567890ab</d:ChannelID>
    <d:CreatedDate m:type="Edm.DateTime">2015-01-01T01:00:00Z</d:CreatedDate>
    <d:Description />
    <d:OwnerName>Stephane Cordonnier</d:OwnerName>
    <d:Title>My Awesome Video</d:Title>
    <d:ID m:type="Edm.Guid">01234567-abcd-cded-1234-1234567890ab</d:ID>
    <d:VideoDurationInSeconds m:type="Edm.Int32">120</d:VideoDurationInSeconds>
    <d:VideoProcessingStatus m:type="Edm.Int32">2</d:VideoProcessingStatus>
    <d:ViewCount m:type="Edm.Int32">10</d:ViewCount>

Retrieve popular videos across all channels, or for a specific channel

It’s great to be able to search for videos but if you use the web version of Office 365 Video, you probably saw that the homepage displays popular videos. I guess you wonder how to retrieve those videos ?

The search endpoint mentioned above has special syntax to get those data. If you want to retrieve popular videos globally or for a specific channel, you have to submit requests using the following URLs:'01234567-abcd-cded-1234-1234567890ab')/Search/Popular

As for simple searches, you can use startItemIndex and itemLimit to perform paging through popular videos.

If you want more information on the Office 365 Video REST API, you can read the official documentation on the MSDN website :

4 thoughts on “Search videos using the Office 365 Video REST API

  1. Pingback: Office 365 Developer Podcast: Episode 050 on the Office 365 Groups API |

  2. Pingback: Office 365 Developer Podcast: Episode 050 on the Office 365 Groups API • PC Portal

  3. Pingback: SharePoint 2013 & Office 365: Recopilatorio de enlaces interesantes (LXVIII)! - Blog de Juan Carlos González en Geeks.MS

  4. Pingback: Office 365 Developer Podcast: Episode 050 on the Office 365 Groups API | Eli Shlomo Blog

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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