Development:Web services API: Difference between revisions
Brian King (talk | contribs) |
Brian King (talk | contribs) |
||
Line 1: | Line 1: | ||
== Overview == | == Overview == | ||
Please also see the discussion about a simple to use xml-rpc based api at [[Development:Simple web services|simple web services]]. | |||
Provide Moodle with a web service interface to allow exchange of data and information with other systems. | Provide Moodle with a web service interface to allow exchange of data and information with other systems. | ||
Specifically, | Specifically, |
Revision as of 15:15, 15 November 2006
Overview
Please also see the discussion about a simple to use xml-rpc based api at simple web services.
Provide Moodle with a web service interface to allow exchange of data and information with other systems.
Specifically,
- 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.
The API will be built in two tiers:
- Generic Moodle web services - This will define the API available to be used by specific protocols.
- Protocol-specific web services - Using the generic services as the parent, define specific interfaces for SOAP, XML-RPC and others.
Class Structure:
Base class server.class.php
:
- This class provides most of the necessary functions to authenticate and communicate with Moodle. It also defines the methods that must be implemented by the protocol class. Any web service protocol class must:
- call the base class constructor (
parent::init()
), - implement the main method (
main([$httpdata])
), - implement the request method (
request($input)
), - implement the reply method (
response($request)
).
- call the base class constructor (
Derived class (e.g. soapserver.class.php
).
The driver for the whole operation is through service.php
. It takes one argument, type
, which contains a string identifying the protocol to use (e.g. 'soap').
So, to call a SOAP based web service:
http://your.server.org/moodle/ws/server.php?type=soap
The data for the entire operation comes through the POST mechanism.
Manage User Data
These functions will allow the exchange of user data, and account management functions. Initial work will use the IMS Enterprise XML standard for data definition.
Manage Course Enrolments
These functions will allow for student, teacher and group management functions within a course. Initial work will use the IMS Enterprise XML standard for data definition.
Manage Courses
These functions will allow for definition and management of courses. Initial work will use the IMS Enterprise XML standard for data definition.
Manage Grades
These functions will allow for information about grades to be exchanged. Initial work will use the IMS Enterprise XML standard for data definition.
See also
- Using Moodle Web Services in forthcoming Moodle and Proposal: Web Services / API / Refactoring Opportunity forum discussions