Web services

Revision as of 02:18, 2 November 2011 by jerome mouneyrac (talk | contribs) (See also)

Jump to: navigation, search

Note: You are currently viewing documentation for Moodle 3.4. Up-to-date documentation for the latest stable version of Moodle is likely available here: Web services.

Web services enable other systems to login to Moodle and perform operations.

How it works

This simple example will give you an idea of how our web services infrastructure works.

  1. The client sends a username and password to the web service login script.
  2. The script returns a token for that user account.
  3. The client calls a particular web service function on a protocol server including the token .
  4. The protocol server uses the token to check that the user can call the function.
  5. The protocol server call the matching external function, located in a externallib.php file inside the relevant module.
  6. The external function checks that the current user has_capability to do this operation.
  7. The external function calls the matching Moodle core function (in lib.php usually).
  8. The core function can return a result to the external function.
  9. The external function will return a result to the protocol server.
  10. The protocol server returns the result to the client.

Administrator documentation

User documentation

Most of the time, the client application will retrieve the key (token) for a user. However, it is still possible for a user to view the key and to regenerate it.

Developer documentation

The full API can be founnd on any Moodle sites under Administration block > Plugins > Web services > API Documentation.

See also

Sharing knowledge:

Specification / core development / brainstorming:

Other implementations: