Using web services
Template:Moodle 2.0This document explains how an administrator set up a web service for ordinary users.
Introduction
A user goes on his security keys page. He gets a security key (also called token). He enters the key on the external application accessing to Moodle. At any time, a user can reset the key if he suspects that it has been stolen. The key is complex, long and difficult to generate. This is the recommended authentication method for web service, and this document explains how to set it up.
Enable the web service in Moodle
Settings block > Site Administration > Advanced features
Check Enable web services option and Save Changes
Enable a protocol
Settings block > Site Administration > Plugins > Web services > Manage protocols
Enable the desired protocol (SOAP, REST, XMLRPC, AMF, ...)
Enable capabilities to users
for create token
for protocols
Create a service with funtions
Settings block > Site Administration > Plugins > Web services > External Services Click on Add new custom service
Add new custom service page
A service is a group of web service functions. You need to know that Moodle tests if a user has the right to use a service. Moodle doesn't test if an user has a right to use a web service function. By default any user using the web service authentication method will be able to call a service. To restrict a service to some user only you need to select the Restricted users option. When this option is enable, by default no user can user this service.
Enter a name, check enable Click on Save changes
Add a function to the service
Settings block > Site Administration > Plugins > Web services > External Services
Click on the Functions link for the newly created service
Service functions page
Select Add function operation, then select a function and Save changes