Development:Web services API: Difference between revisions
Line 21: | Line 21: | ||
// $method is something like: "mod/forum/lib/forum_add_instance" | // $method is something like: "mod/forum/lib/forum_add_instance" | ||
// $params is an array of parameters. A parameter might itself be an array. | // $params is an array of parameters. A parameter might itself be an array. | ||
// use only Whitelist characters that are permitted in a method name | |||
// The method name must not begin with a / - avoid absolute paths | |||
// A dot character . is only allowed in the filename, i.e. something.php | |||
==Things you can do== | ==Things you can do== |
Revision as of 05:56, 19 July 2007
Overview
The Web Services API provides Moodle with a web service interface to allow exchange of data and information with other systems.
For example,
- Manage user data - send and retrieve the information,
- Manage course enrolments - add/remove teachers and students,
- Course management - create new courses based on templates,
- Gradebook info - extract grades information from Moodle.
XML-RPC background
The XML-RPC service allows other servers to contact your Moodle server and request that it call a function. The Moodle server might do something, like create a user, or it might fetch some data and serve it back to your host.
To communicate like this with another Moodle host, you'd normally use the Moodle Network [1] features, but it's also possible for other kinds of program to contact your Moodle, using plain-old-XML-RPC, with Moodle Network's encryption or signed-message features.
The server script
- allow trusted sites to access web services by configuring /admin/mnet/trustedhosts.php
- start by pointing your browser to /mnet/xmlrpc/server.php - this should show an XML error message
// $method is something like: "mod/forum/lib/forum_add_instance" // $params is an array of parameters. A parameter might itself be an array. // use only Whitelist characters that are permitted in a method name // The method name must not begin with a / - avoid absolute paths // A dot character . is only allowed in the filename, i.e. something.php
Things you can do
See also
- Using Moodle Web Services forum