//Management Service account $username = "akoestiq"; $password = "!BhSSD#P"; /////////////////////////////////////////////////////// //Akoestiq/Liveuitvaart required input // // //Date and Time of the webcast $ScheduledStart = "2012-01-01T00:00:00Z"; // //ProfileId is a required field for any Webcast, as it contains //configuration data that is necessary for producing a webcast, some //of which cannot currently be manipulated through the Company Webcast API. //Each Customer in the Company Webcast data model has at least 1 and possibly //more Profiles. In Akoestiq's case, there will be 1 Profile for each individual //"room" at a Customer's location. A Profile's Title property will contain //room specific descriptive text, like "Kamer 1" and "Kamer 2". //At this point in our script, we do not yet know which Customers are available //to us (API user akoestiq), so we also do not yet know which Profiles to use. //This sample code demonstrates how to retrieve a list of Customers, and get a //Specific customer so we can see which Profiles are available. $CustomerCode = ""; //not yet known $ProfileId = ""; //not yet known // //Custom datafields specific to this application $Expando = array( "NextOfKin-Saluation" => "Beste", "NextOfKin-Initials" => "M.J.J.", "NextOfKin-Preposition" => "van der", "NextOfKin-LastName" => "Brouns", "NextOfKin-Email" => "marcel.brouns@companywebcast.com", "Deceased-Name" => "Wilfred het Konijn", "Deceased-DateOfBirth" => "2001-01-01T00:00:00Z", "Deceased-DateOfDeath" => "2011-01-01T00:00:00Z", "Contractor-Name" => "Uitvaart Onderneming B.V.", "Contractor-Email" => "contractor@gmail.com"); // //The title, tags and reference fields are used here because //they make locating a Webcast in the Management and Metaservice //easier: the WebcastSearch method allows you to, a.o., search for //Title, Tags and Reference. //Note that the Reference field is designed to contain your own //identifier, the Company Webcast systems will not touch this field //in any way. // //Title of the Webcast $Title = $Expando"Deceased-Name"; // //Tags for easier navigation $Tags = array($Expando"Contractor-Name"); // //Reference can be used for third party identifiers $Reference = "Fourtress_Unique_Event_Identifier"; /////////////////////////////////////////////////////// // Set up the client // Bug found in service: Service returns -1 in WebcastGet if the Webcast contains a GenericItem // Temporary workaround: use .trunk version of Management Service // Note: you will need to return to the production version by November 11th. $client = new SoapClient('https://services.companywebcast.com/management/2.0/ManagementService.svc?wsdl', array('features' => SOAP_SINGLE_ELEMENT_ARRAYS)); // CustomerList Method // retrieves the list of customers for which the user is authorized $CustomerListParameters = new stdClass(); $CustomerListParameters->Username = $username; $CustomerListParameters->Password = $password; $CustomerListParameters->PageNumber = 0; $CustomerListParameters->PageSize = 100; // Call the CustomerList Method on the ManagementService $CustomerListResponse = $client->CustomerList($CustomerListParameters); // CustomerListResult contains an integer // that indicates the success or failure of your request $CustomerListResult = $CustomerListResponse->CustomerListResult; // CustomerSummaries contains a collection of CustomerSummary $CustomerSummaries = $CustomerListResponse->CustomerSummaries; if ( $CustomerListResult == 0 && property_exists($CustomerSummaries, "CustomerSummary") && count($CustomerSummaries->CustomerSummary) > 0) { // CustomerList was successful and we have access to 1 or more customers $Customers = $CustomerSummaries->CustomerSummary; // For this demo: grab the first Customer in the list $CustomerCode = $Customers0->Code; // CustomerGet Method // retrieves a customer $CustomerGetParameters = new stdClass(); $CustomerGetParameters->Username = $username; $CustomerGetParameters->Password = $password; $CustomerGetParameters->CustomerCode = $CustomerCode; // Call the CustomerGet method $CustomerGetResponse = $client->CustomerGet($CustomerGetParameters); // ProfileListResult contains an integer // that indicates the success or failure of your request $CustomerGetResult = $CustomerGetResponse->CustomerGetResult; if ($CustomerGetResult == 0) { // CustomerGet was succesful // We retrieved a Customer // Customer contains information about a customer, such as a list of // Profiles and Modules this Customer has access to. $Customer = $CustomerGetResponse->Customer; //For this demo : grab the first Profile in the list $ProfileId = $Customer->Profiles->Profile0->Id; // WebcastCreate Method // creates a new Webcast based on a Profile $WebcastCreateParameters = new stdClass(); $WebcastCreateParameters->Username = $username; $WebcastCreateParameters->Password = $password; $WebcastCreateParameters->CustomerCode = $CustomerCode; $WebcastCreateParameters->ProfileId = $ProfileId; $WebcastCreateParameters->ScheduledStart = $ScheduledStart; // Call the WebcastCreate Method $WebcastCreateResponse = $client->WebcastCreate($WebcastCreateParameters); // WebcastCreateResult contains an integer // that indicates the success or failure of your request $WebcastCreateResult = $WebcastCreateResponse->WebcastCreateResult; // WebcastCode contains a string that uniquely identifies this Webcast $WebcastCode = $WebcastCreateResponse->WebcastCode; if ($WebcastCreateResult == 0) { // WebcastCreate was successful // WebcastGet Method // Retrieves the data for a Webcast $WebcastGetParameters = new stdClass(); $WebcastGetParameters->Username = $username; $WebcastGetParameters->Password = $password; $WebcastGetParameters->WebcastCode = $WebcastCode; // Call the WebcastGet method $WebcastGetResponse = $client->WebcastGet($WebcastGetParameters); // WebcastGetResult contains an integer // that indicates the success or failure of your request $WebcastGetResult = $WebcastGetResponse->WebcastGetResult; // Webcast contains the Webcast data object $Webcast = $WebcastGetResponse->Webcast; if ($WebcastGetResult == 0) { // WebcastGet was successful //Put the Deceased-Name in the Webcast Title $Webcast->Title = $Expando"Deceased-Name"; //Add the Reference property $Webcast->Reference = $Reference; //Add the tags if (!property_exists($Webcast->Tags, "string")) { $Webcast->Tags->string = array(); } $Webcast->Tags->string = $Tags; // Check if this webcast has a GenericItems array, if not create it if (!property_exists($Webcast->GenericItems, "GenericItem")) { $Webcast->GenericItems->GenericItem = array(); } foreach ($Expando as $key => $value){ // Create a new GenericItem and add it to our Webcast $NewGenericItem = new stdClass(); $NewGenericItem->Reference = $key; $NewGenericItem->Value = $value; array_push($Webcast->GenericItems->GenericItem, $NewGenericItem); } // WebcastSave Method // Saves changes to a Webcast $WebcastSaveParameters = new stdClass(); $WebcastSaveParameters->Username = $username; $WebcastSaveParameters->Password = $password; $WebcastSaveParameters->Webcast = $Webcast; // Call the WebcastSave method $WebcastSaveResponse = $client->WebcastSave($WebcastSaveParameters); // WebcastSaveResult is an integer that indicates the // success or failure of your request $WebcastSaveResult = $WebcastSaveResponse->WebcastSaveResult; // As you create new webcasts and make changes to existing ones, // the ManagementService wants you to make sure you are always // working on the most recent version of that webcast. // It does this through the Webcast->WebcastRevision property, // which is a string that is automatically updated with every // change made to a Webcast. Here WebcastSave returns it for us // in the response. $WebcastRevision = $WebcastSaveResponse->WebcastRevision; if ($WebcastSaveResult == 0) { // WebcastSave method was successful // Webcast Delete Method // Deletes a Webcast $WebcastDeleteParameters = new stdClass(); $WebcastDeleteParameters->Username = $username; $WebcastDeleteParameters->Password = $password; $WebcastDeleteParameters->WebcastCode = $WebcastCode; $WebcastDeleteParameters->WebcastRevision = $WebcastRevision; // Call the WebcastDeleteMethod $WebcastDeleteResponse = $client->WebcastDelete($WebcastDeleteParameters); // WebcastDeleteResult is an integer that indicates the // success or failure of your request $WebcastDeleteResult = $WebcastDeleteResponse->WebcastDeleteResult; if ($WebcastDeleteResult == 0) { // WebcastDelete method was successful $celebrate = true; } } } } } } ?>