Note: You are currently viewing documentation for Moodle 2.2. Up-to-date documentation for the latest stable version is available here: Using web services.

Using web services

From MoodleDocs
Revision as of 08:29, 15 January 2010 by jerome mouneyrac (talk | contribs)

Template:Moodle 2.0This document explains how an administrator set up a web service for ordinary users.

Token authentication method

Enable the web service in Moodle

  Settings block > Site Administration > Advanced features
Check Enable web services option and Save Changes

enable ws option.png

Enable a protocol

  Settings block > Site Administration > Plugins > Web services > Manage protocols
Enable the desired protocol (SOAP, REST, XMLRPC, AMF, ...)

ws manageprotocal settings.png

Create a new user

  Settings block > Site Administration > Users > Accounts > Add a new user
Select Web services option for Choose an authentication method. This user will not be able to log into the site but can access web service. Complete the other fields and select Update profil operation

ws authentication settings.png

Enable capabilities to specific user

for protocols

Create a service with funtions

  Settings block > Site Administration > Plugins > Web services > External Services
  Click on Add new custom service

externlservices settings.png


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 webservice.png

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

wsfunctionadmin.png

selectservicefunction.png


Admin create token for specific user

Variant: simple authentication method

Enable the web service authentication plugin

  Settings block > Site Administration > Users > Authentication > Manage authentication
Enable Web services

ws manageauth settings.png