How to enable web services for an external system: Difference between revisions
Matt Gibson (talk | contribs) |
|||
(27 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{Moodle_2.0}} | {{Moodle_2.0}} | ||
This document explains how an administrator can set up a web service | This document explains how an administrator can set up a web service for one external system. One token will be generated during this setup. The external system administrator will enter the token into the external system. The external system users do not need to enter any personal security key. | ||
= | == First steps == | ||
# [https://docs.moodle.org/en/How_to_enable_web_services_for_ordinary_users#Enable_web_service_feature Enable web service feature] | |||
# [https://docs.moodle.org/en/How_to_enable_web_services_for_ordinary_users#Enable_a_protocol Enable a protocol] | |||
# [https://docs.moodle.org/en/How_to_enable_web_services_for_ordinary_users#Enable_the_web_service_function_documentation Enable the web service function documentation] | |||
# [https://docs.moodle.org/en/How_to_enable_web_services_for_ordinary_users#Create_a_service Create a service] '''however you must check''' ''Authorised users only'' | |||
# [https://docs.moodle.org/en/How_to_enable_web_services_for_ordinary_users#Add_functions_to_the_service Add functions to the service] | |||
== Create a user for the external system == | |||
= | |||
Settings block > Site Administration > Users > Accounts > Add a new user<br/> | Settings block > Site Administration > Users > Accounts > Add a new user<br/> | ||
Complete the | Complete the fields and select '''Update profile''' operation | ||
== | == Authorise the user== | ||
[[Image:Authorised users link.jpg|thumb]] [[Image:Authorised user selection page.jpg|thumb]] | |||
Settings block > Site Administration > Plugins > Web services > External Services | |||
Select '''Authorised users''' link | |||
Select the created user and click '''Add''' | |||
As you can see in the second screen capture, Moodle indicates if some capabilities need to be assigned to an authorised user. Moreover if you click on the authorised user you can setup some specific options: IP restriction and Valid until. | |||
. | |||
== | == Create a token == | ||
[[Image:Create_token.jpg|thumb]] | |||
Settings block > Site Administration > Plugins > Web services > Manage tokens | |||
Click on '''Add''' | |||
Select the created user and service | |||
Click on '''Saves changes''' | |||
== | == Enable capabilities for the user== | ||
The | The last step, and the trickiest, is to grant the right permission to the external system user. It would need the following capabilities: | ||
* "''webservice/rest:use'', ''webservice/soap:use'', ''webservice/xmlrpc:use'', ''webservice/amf:use''" matching the enabled protocols. | |||
* the required capabilities by the web service functions. These required capabilities are listed when you add a function to the service. | |||
As you previously created a token for the external system user, you do not need to assign "''moodle/webservice:createtoken''" to it. | |||
For more information about roles and capabilities, read the [https://docs.moodle.org/en/Manage_roles Manage roles] documentation. | |||
[[Image:The token.jpg|thumb]]The external system administrator can connect into Moodle and see the token into his/her [https://docs.moodle.org/en/How_to_get_a_security_key security keys] page. Or you can directly tell him is token if you don't want to communicate his/her web login/password (in this case think to give him/her a copy of the web service function documentation located on his/her [https://docs.moodle.org/en/How_to_get_a_security_key security keys] page). | |||
[[Image: | |||
= See also= | |||
* [https://docs.moodle.org/en/Web_Services Web services] | |||
* [[How to enable web services for ordinary users]] | |||
[[Category:Web Services]] | [[Category:Web Services]] |
Latest revision as of 07:18, 18 January 2011
Moodle 2.0
This document explains how an administrator can set up a web service for one external system. One token will be generated during this setup. The external system administrator will enter the token into the external system. The external system users do not need to enter any personal security key.
First steps
- Enable web service feature
- Enable a protocol
- Enable the web service function documentation
- Create a service however you must check Authorised users only
- Add functions to the service
Create a user for the external system
Settings block > Site Administration > Users > Accounts > Add a new user
Complete the fields and select Update profile operation
Authorise the user
Settings block > Site Administration > Plugins > Web services > External Services Select Authorised users link Select the created user and click Add
As you can see in the second screen capture, Moodle indicates if some capabilities need to be assigned to an authorised user. Moreover if you click on the authorised user you can setup some specific options: IP restriction and Valid until.
.
Create a token
Settings block > Site Administration > Plugins > Web services > Manage tokens Click on Add Select the created user and service Click on Saves changes
Enable capabilities for the user
The last step, and the trickiest, is to grant the right permission to the external system user. It would need the following capabilities:
- "webservice/rest:use, webservice/soap:use, webservice/xmlrpc:use, webservice/amf:use" matching the enabled protocols.
- the required capabilities by the web service functions. These required capabilities are listed when you add a function to the service.
As you previously created a token for the external system user, you do not need to assign "moodle/webservice:createtoken" to it. For more information about roles and capabilities, read the Manage roles documentation.
The external system administrator can connect into Moodle and see the token into his/her security keys page. Or you can directly tell him is token if you don't want to communicate his/her web login/password (in this case think to give him/her a copy of the web service function documentation located on his/her security keys page).