Skip to content

Latest commit

 

History

History
41 lines (31 loc) · 1.11 KB

README.md

File metadata and controls

41 lines (31 loc) · 1.11 KB

Loaded REST

A Moodle webservice protocol implementation that allows requests with bodies. It's not true REST as it's not resourceful.


Installation

  1. Place this repository in /webservice/loadedrest.
  2. Execute the Moodle upgrades via the CLI or web UI.

Configuration

  1. Ensure Enable web services is enabled under Site administration > Advanced features.
  2. Navigate to Site administration > Plugins > Web services > Manage protocols and enable Loaded REST protocol.
  3. Assign the Use Loaded REST protocol capability to the desired roles under Site administration > Users > Permissions > Define roles.

Sample client usage

use webservice_loadedrest\client;

$serverurl = '/webservice/loadedrest/server.php';
$token = '000000000000000000000000000000000000';
$httpmethod = 'PUT';
$wsfunction = 'component_function';
$params = [
    'myargs' => [
        [
            'param' => 'look, nesting!',
        ],
    ],
];

$client = new client($serverurl, $token);
try {
    var_dump($client->call($httpmethod, $wsfunction, $params));
} catch (Exception $e) {
    var_dump($e);
}