Companywebcast API Wiki


$username = "testuser"; $password = "0123456789";

// Set up the client $client = new SoapClient('https://services.companywebcast.com/management/1.1/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;

// CustomerGet Method // retrieves a customer $CustomerGetParameters = new stdClass(); $CustomerGetParameters->Username = $username; $CustomerGetParameters->Password = $password; $CustomerGetParameters->CustomerId = $Customers0->Id;

// 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;

// WebcastCreate Method // creates a new Webcast based on a Profile $WebcastCreateParameters = new stdClass(); $WebcastCreateParameters->Username = $username; $WebcastCreateParameters->Password = $password; $WebcastCreateParameters->CustomerId = $Customer->Id; $WebcastCreateParameters->ProfileId = $Customer->Profiles->Profile0->Id; $WebcastCreateParameters->ScheduledStart = "2010-12-29T12:12:28Z";

// 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 contain 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

// Check if this webcast has a Topics array, if not create it if (!property_exists($Webcast->TopicsModule->Topics->Topics0, "Topic")) { $Webcast->TopicsModule->Topics->Topics0->Topic = array(); }

// Create a new Topic and add it to our Webcast $NewTopic = new stdClass(); $NewTopic->Title = "New Topic Title"; $NewTopic->Description = "New Topic Description"; $NewTopic->Reference = "Arbitrary Identifier"; $NewTopic->Tags->string = array("some","new","tags");

$NewTopicAttachment = new stdClass(); $NewTopicAttachment->Description = "Attachment Description"; $NewTopicAttachment->Url = "Attachment Url"; $NewTopic->Attachments->TopicAttachment = array(); array_push($NewTopic->Attachments->TopicAttachment, $NewTopicAttachment);

array_push($Webcast->TopicsModule->Topics->Topics0->Topic, $NewTopic);

// WebcastSave Methode // 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 date string that is automatically updated with every // change made to a Webcast. Here WebcastSave returned 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; } } } } } } ?>