Skip to content

om-hosting/openmeetings-php-client

Repository files navigation

openmeetings-php-client

Packagist License GitHub issues Packagist Version Packagist Downloads

PHP composer managed package to connect to OpenMeetings REST API (https://openmeetings.apache.org/swagger/).

See also: https://packagist.org/packages/om-hosting/openmeetings-php-client

Example use case

See the example use case at: https://om-hosting.com/openmeetings-integration-php-composer/

Version and compatibility

openmeetings-php-client description
version 1.x.x Guzzle v 6.x.x
version 2.x.x Guzzle v 7.x.x and later

Installation

Install packagist package:

php composer.phar install openmeetings-php-client

Usage: Example usage:

        $BASE_URL = "http://localhost:5080/openmeetings";
    
        //1. Login to service
        $config = new Configuration();
        $config->setHost($BASE_URL . '/services');
        $userApiInstance = new UserServiceApi(null, $config);
        $serviceResultLoginWrapper = $userApiInstance->login("soapuser", "!HansHans1");
        if ($serviceResultLoginWrapper->getServiceResult()->getType() != "SUCCESS") {
            $text = "Login Failed " . $serviceResultLoginWrapper->getServiceResult()->getMessage();
            return view('hello_index', ['text' => $text]);
        }
        $sid = $serviceResultLoginWrapper->getServiceResult()->getMessage();

        // 2. Generate Hash for entering a conference room
        $serviceResultHashWrapper = $userApiInstance->getRoomHash($sid,
            new ExternalUserDTO(
                array(
                    "firstname" => "John",
                    "lastname" => "Doe",
                    "external_id" => "uniqueId1",
                    "external_type" => "myCMS",
                    "login" => "john.doe",
                    "email" => "john.doe@gmail.com"
                )
            ),
            new RoomOptionsDTO(
                array(
                    "room_id" => 2,
                    "moderator" => true
                )
            )
        );

        // 3. Construct Login URL
        $hash = $serviceResultHashWrapper->getServiceResult()->getMessage();
        $url = $this->BASE_URL . "/hash?secure=".$hash;

See also example project code at: https://github.com/om-hosting/openmeetings-php-laravel-sample-project

Description

Integration API enables to connect to an OpenMeetings instance, eg for generating users, create links to directly access conference rooms.

It is mainly designed for Server2Server integration, for example to integrate into your website, CMS or 3rd party application

For examples how to use the Rest API see https://openmeetings.apache.org/RestAPISample.html.

Community contributed modules for using this API include for example:

Other community plugins using this API for Moodle, SugarCRM, Drupal, Joomla can be found in the Configuration>Plugins section at https://openmeetings.apache.org

Initial version of this PHP package is automatically generated by the Swagger Codegen project:

Requirements

PHP 5.5 and later

Installation & Usage

Composer

To install the bindings via Composer, add the following to composer.json:

{
  "repositories": [
    {
      "type": "git",
      "url": "https://github.com/om-hosting/openmeetings-php-client.git"
    }
  ],
  "require": {
    "om-hosting/openmeetings-php-client": "*@dev"
  }
}

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/openmeetings-php-client/vendor/autoload.php');

Tests

To run the unit tests:

composer install
./vendor/bin/phpunit

Getting Started

Please follow the installation procedure and then run the following:

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$id = 789; // int | the id to delete

try {
    $result = $apiInstance->delete($sid, $id);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->delete: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$roomid = 789; // int | id of appointment special room

try {
    $result = $apiInstance->getByRoom($sid, $roomid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->getByRoom: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$title = "title_example"; // string | the search string

try {
    $result = $apiInstance->getByTitle($sid, $title);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->getByTitle: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin

try {
    $result = $apiInstance->next($sid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->next: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$userid = 789; // int | the userId the calendar events should be loaded

try {
    $result = $apiInstance->nextForUser($sid, $userid);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->nextForUser: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$start = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | start time
$end = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | end time

try {
    $result = $apiInstance->range($sid, $start, $end);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->range: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$userid = 789; // int | the userId the calendar events should be loaded
$start = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | start time
$end = new \DateTime("2013-10-20T19:20:30+01:00"); // \DateTime | end time

try {
    $result = $apiInstance->rangeForUser($sid, $userid, $start, $end);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->rangeForUser: ', $e->getMessage(), PHP_EOL;
}

$apiInstance = new Swagger\Client\Api\CalendarServiceApi(
    // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`.
    // This is optional, `GuzzleHttp\Client` will be used as default.
    new GuzzleHttp\Client()
);
$sid = "sid_example"; // string | The SID of the User. This SID must be marked as Loggedin
$appointment = new \Swagger\Client\Model\AppointmentDTO(); // \Swagger\Client\Model\AppointmentDTO | 

try {
    $result = $apiInstance->save($sid, $appointment);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling CalendarServiceApi->save: ', $e->getMessage(), PHP_EOL;
}
?>

Documentation for API Endpoints

All URIs are relative to http://localhost:5080/openmeetings/services

Class Method HTTP request Description
CalendarServiceApi delete DELETE /calendar/{id}
CalendarServiceApi getByRoom GET /calendar/room/{roomid}
CalendarServiceApi getByTitle GET /calendar/title/{title}
CalendarServiceApi next GET /calendar/next
CalendarServiceApi nextForUser GET /calendar/next/{userid}
CalendarServiceApi range GET /calendar/{start}/{end}
CalendarServiceApi rangeForUser GET /calendar/{userid}/{start}/{end}
CalendarServiceApi save POST /calendar
ErrorServiceApi get GET /error/{key}/{lang}
ErrorServiceApi report POST /error/report
FileServiceApi add POST /file
FileServiceApi delete1 DELETE /file/{id}
FileServiceApi deleteExternal DELETE /file/{externaltype}/{externalid}
FileServiceApi getAllExternal GET /file/{externaltype}
FileServiceApi getRoom GET /file/room/{id}
FileServiceApi getRoomByParent GET /file/room/{id}/{parent}
FileServiceApi move POST /file/move/{roomid}/{id}/{parentid}
FileServiceApi rename POST /file/rename/{id}/{name}
GroupServiceApi add1 POST /group
GroupServiceApi addRoom POST /group/{id}/rooms/add/{roomid}
GroupServiceApi addUser POST /group/{id}/users/{userid}
GroupServiceApi delete2 DELETE /group/{id}
GroupServiceApi get1 GET /group
GroupServiceApi getUsers GET /group/users/{id}
GroupServiceApi removeUser DELETE /group/{id}/users/{userid}
InfoServiceApi getHealth GET /info/health
InfoServiceApi getVersion GET /info/version
NetTestServiceApi get2 GET /networktest
NetTestServiceApi upload POST /networktest
RecordingServiceApi delete3 DELETE /record/{id}
RecordingServiceApi getExternal GET /record/{externaltype}/{externalid}
RecordingServiceApi getExternalByRoom GET /record/room/{roomid}
RecordingServiceApi getExternalByType GET /record/{externaltype}
RoomServiceApi add2 POST /room
RoomServiceApi cleanWb GET /room/cleanwb/{id}
RoomServiceApi close GET /room/close/{id}
RoomServiceApi count GET /room/count/{roomid}
RoomServiceApi delete4 DELETE /room/{id}
RoomServiceApi getExternal1 GET /room/{type}/{externaltype}/{externalid}
RoomServiceApi getPublic GET /room/public/{type}
RoomServiceApi getRoomById GET /room/{id}
RoomServiceApi hash POST /room/hash
RoomServiceApi kick GET /room/kick/{id}/{externalType}/{externalId}
RoomServiceApi kickAll GET /room/kick/{id}
RoomServiceApi open GET /room/open/{id}
RoomServiceApi users GET /room/users/{roomid}
UserServiceApi add3 POST /user
UserServiceApi delete5 DELETE /user/{id}
UserServiceApi deleteExternal1 DELETE /user/{externaltype}/{externalid}
UserServiceApi get3 GET /user
UserServiceApi getRoomHash POST /user/hash
UserServiceApi login GET /user/login
WbServiceApi cleanSlide GET /wb/cleanslide/{roomid}/{wbid}/{slide}
WbServiceApi cleanWb1 GET /wb/cleanwb/{roomid}/{wbid}
WbServiceApi resetWb GET /wb/resetwb/{id}
WbServiceApi uploadWb POST /wb/uploadwb/{type}

Documentation For Models

Documentation For Authorization

Authentication token is acquired via calling UserServiceApi->login

Author

Sebastian Wagner https://om-hosting.com