Panopto API 201: Getting sessions

Return to the Panopto API index page

Before you begin on this page you’ll need the starting code from page 100 and I highly recommend increasing the buffer size of results from page 101. You can expect queries that return more than a couple of results to crash without it.

On this page we are going to produce the same type of list we made for folders, but this time for sessions.

Paste the following code in the // PUT YOUR AUTHENTICATION DETAILS HERE section

The rest of the code goes under // START WRITING CODE HERE. First of all we’ll make some pages, just like we did for folders

You’ll notice that I’ve changed the maximum number of results to 100.

Leave a blank line and paste the following code (we’re going to fill in the blank link once I’ve explained what were doing)

You’ll notice that the first line is exactly the same as when we searched for folders. The list commands are part of SessionManagementClient so we need to make an object to do the searching from.

The second line is what differs from the folder query. We’re using the command GetSessionsList, which requires us to send the AuthenticationInfo as normal, then a ListSessionsRequest and finally a search query (string, can be null).

So the preceding two lines are likely to be very re-usable. Now we’ll make the request variable.

Take a look at…bbf226d518f8.htm for everything you can put into the request, but for my example I’m going to return all the sessions for a particular folder ID.

Pro tip: Match this code with page 102 to find the folder ID of a folder by name, then list the sessions in it with this code.

Paste this code above ISessionManagement,,,

The four lines should look like this now

So out of the many things I can request, I’ve just told it pick sessions with the folder ID 7608…

We can return the sessions in the same way as with folders, but instead of  Folder folder we’ll use Session session

All sessions are returned. You could build your own RSS feed or video listings page just from this information.

Full code below

Return to the Panopto API index page

Leave a Reply

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