Aquesta pàgina forma part de la documentació de Moodle en català, tot i que no ha estat traduïda encara. Podeu contribuir obertament a les tasques de traducció. Podeu consultar la Guia d'edició de la documentació i també participar ens els debats del fòrum de traductors de la documentació a moodle.org

Especial:Badtitle/NS100:Web services API: diferència entre les revisions

De MoodleDocs
Salta a:navegació, cerca
Línia 44: Línia 44:
== Code ==
== Code ==
The code is available in the contrib/patches/ws directory of cvs.
The code is available in the contrib/patches/ws directory of cvs.
cvs -z3 -d:pserver:anonymous@moodle.cvs.sourceforge.net:/cvsroot/moodle/contrib/patches/ws co contrib/patches/ws


==See also==
==See also==

Revisió del 11:44, 2 feb 2007

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,

  1. Manage user data - send and retrieve the information,
  2. Manage course enrolments - add/remove teachers and students,
  3. Course management - create new courses based on templates,
  4. Gradebook info - extract grades information from Moodle.

The API will be built in two tiers:

  1. Generic Moodle web services - This will define the API available to be used by specific protocols.
  2. 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)).

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.

Code

The code is available in the contrib/patches/ws directory of cvs.

cvs -z3 -d:pserver:anonymous@moodle.cvs.sourceforge.net:/cvsroot/moodle/contrib/patches/ws co contrib/patches/ws

See also