A Moodle webservice protocol implementation that allows requests with bodies. It's not true REST as it's not resourceful.
- Place this repository in
/webservice/loadedrest
. - Execute the Moodle upgrades via the CLI or web UI.
- Ensure Enable web services is enabled under Site administration > Advanced features.
- Navigate to Site administration > Plugins > Web services > Manage protocols and enable Loaded REST protocol.
- Assign the Use Loaded REST protocol capability to the desired roles under Site administration > Users > Permissions > Define roles.
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);
}