maid0marion / Panopto-PHP-Client

Simple PHP client for Panopto, it makes working with the API much easier

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panopto-PHP-Client

This is a standalone PHP client to Panopto API's 4.0 and 4.2, 4.2 is what is used in the PanoptoBookingEngine and is therefore slightly more mature. You shouldn't mix and match clients, user either 4.0 or 4.2.

This client does not support the whole API, but using a combination of the pattern used here and the soap docs functionality it would be fairly straight forward to add the missing functionality.

As of yet, the API for 4.3 has not been tested but should work, however we will need to update our copy of the source when we upgrade to 4.3 so an updated version should appear here at some point.

The code is split into several sections:

  • /includes/client: Abstract client
  • /includes/commons: Useful/repeatedly used code
  • /includes/dataObjects/objects: PHP implementations of the Panopto API Version 4.0 objects
  • /includes/dataObjects/objects/requests: Panopto API Version 4.0 parameter objects used to pass requests to the API
  • /includes/dataObjects/objects/responses: Panopto API Version 4.0 return type objects used to receieve responses from the API
  • /includes/impl/4.X/client: Versioned implementations of clients to the various Panopto Endpoints
  • /includes/impl/4.2/dataObjects: Extra request and response objects used in the new version of the API; where compatible, the 4.2 client still uses the original 4.0 API objects under /includes/dataObjects/
  • /logger: A small class to easily insert DEBUG logging into a file, you can vardump or just log a string, everything is date and timestamped :)
  • /soapDocs: This shows you the soapPHP's view of the API, you can see lists of methods and objects

What are the dataObjects, requests and response objects for?

Essentially these objects wrap the XML returned and required by the panopto endpoints in PHP objects, most are basically public access variables inside a class. This could probably be cleaned up to make it a little stricter "OO" but in some instances the variables need to be public access to be set by the soap library.

Ultimately what this gives you is the ability to work "only" with objects and abstracts the (often) ugliness of dealing with web services.

Using the code

Copy this code into your PHP working directory and include a client for the version and endpoint you want to talk to (under /includes/impl/4.X/client/), then create an AuthenticationInfo object and populate with user/pass details, finally create a new instance of the endpoint you want to talk to passing the server url and auth details....

	require_once(dirname(__FILE__)."/includes/client/impl/AccessManagementClient.php");
	error_reporting(E_ALL);
	date_default_timezone_set("Europe/London");

	$server = "panoptoserver.url.here";
	$auth = new AuthenticationInfo("user","password",null);
	$AMClient = new AccessManagementClient($server, $auth);

You should not need to include the dataObject, request and reponse object's in your code after you have included a client as all the dependancies should be included in the client.

Using the client object you can then directly call the methods (outlined below)...

Endpoints and methods implemented:

Key -> Supported API versions - response type Web Service Method([<( parameter type ) parameter>,....])

Please take this as complementary to the official Panopto API (which has slightly more detail)

Note: I use the "array()", "String" and "Boolean" type to denote the standard primitives in PHP, not any special object I've made, in the case of array(), inside the brackets is the type of objects inserted in the to array, so array(String) denotes "create an array with strings in".

AccessManagement

4.0/4.2 - GetFolderAccessDetailsResponse getFolderAccessDetails(
   <( String ) Folder id>)

Authentication

4.0/4.2 - logOnWithExternalProvider(
   <( String ) User Key>,
   <( String ) Authentication code>)

RemoteRecorder

4.2 - GetRemoteRecordersByExternalIdResponse getRemoteRecorderByExternalId(
   <( String ) The external Id of the remote recorder you want to fetch>)

4.2 - GetRemoteRecordersByExternalIdResponse getRemoteRecordersByExternalId()

4.0/4.2 - GetListRecordersResponse getRemoteRecordersList(
   <( Pagination ) Pagination settings for the response>,
   <( String ) The field you want to sort by>)

4.0/4.2 - scheduleNewRecurringRecording(
   <( String ) Name of the recording>,
   <( String ) Id of the folder the recording will be scheduled into>,
   <( String ) Start datetime>,<( String ) End datetime>,
   <( array(String) ) Days of the week you want the schedule to recur on>,
   <( String ) The ending date time when you want the schedule to stop recurring>,
   <( RecorderSettings ) Specifies the settings for the recorders used for the recordings being scheduled>,
   <( Boolean ) Whether you want the recording broadcast or not>)

4.0/4.2 - ScheduleRecordingResponse scheduleRecording(
   <( String ) Name of the recording>,
   <( String ) Id of the folder the recording will be scheduled into>,
   <( String ) Start datetime>,<( String ) End datetime as a string>,
   <( RecorderSettings ) Specifies the settings for the recorders used for the recordings being scheduled>,
   <( Boolean ) Whether you want the recording broadcast or not>)

4.0/4.2 - ScheduleRecurringRecordingResponse scheduleRecurringRecording(
   <( String ) The session Id for the schedule you want to recur>,
   <( array(String) ) Days of the week you want the schedule to recur on>,
   <( String ) The ending date time when you want the schedule to stop recurring>,
   <( Boolean ) Do you want to add the original schedule Id to the list of recurrance>)

4.2 - setRemoteRecorderExternalId(
   <( String ) The Id of the remote recorder you want to set its external Id for>,
   <( String ) The external Id that you want to set>)

SessionManagement

4.0/4.2 - AddFolderResponse addFolder(
   <( String ) The name of the folder you want to create>
   <( String ) The Id of the folder you want this folder to go into, leave null for the top level>
   <( Boolean ) If the folder is publically viewable or not>)

4.0/4.2 - AddSessionResponse addSession(
   <( String ) The name of the session you want to add to a folder>
   <( String ) The Id of the folder you want this session to go into>
   <( Boolean ) If the session will be broadcast or not>)

4.0/4.2 - deleteSessions(
   <( array(String) ) Delete all sessions specified in the array of session Id's>)

4.2 - GetFoldersByExternalIdResponse getFoldersByExternalId(
   <( array(String) ) Get all folders specified in the array of folder external Id's>)

4.0/4.2 - GetFoldersListResponse getFoldersList(
   <( ListFoldersRequest ) Specifies all the settings for how the response will be formatted>,
   <( String ) A simple search query>)

4.2 - GetSessionsByExternalIdResponse getSessionsByExternalId(
   <( array(String) ) Get all sessions specified in the array of session external Id's>)

4.0/4.2 - GetSessionsListResponse getSessionsList(
   <( ListSessionsRequest ) Specifies all the settings for how the response will be formatted>
   <( String ) A simple search query>)

4.2 - updateSessionExternalId(
   <( String ) The Id of the session you want to set its external Id for>,
   <( String ) The external Id that you want to set>)

UserManagement

4.0/4.2 - GetUsersResponse GetUsers(
   <( array(String) ) Get all users specified in the array of user Id's>)

How to use /soapDocs (if you want to!)

About

Simple PHP client for Panopto, it makes working with the API much easier

License:GNU General Public License v3.0