Introduction
In order to provide Coachview access via web services, the following settings are important in Moodle. If you are logged in as an administrator you can use the URL (see the last column in the table) to jump directly to the page in Moodle to set up the various data. For example: https://moodle.coachview.net/admin/settings.php?section=webserviceprotocols.

Support/tested up to version 2.9 (note screens 3.0 and higher may differ). You can check your Moodle version via 'Site-administration' and 'Registrations'.


Settings Moodle:
Setting
Value
URL
Enable web services
yes
/admin/search.php?query=enablewebservices

Enable protocols
Enable ‘REST protocol’
/admin/settings.php?section=webserviceprotocols

Create user account.

Click on the 'Add' button.


Username = ws_coachview.net

Authentication method = Webservice authentication

First name: Web service (= example)

Last name: Coachview (= example)

E-mail address: test@coachview.net (= example)


Click on 'Create user'.


/admin/user.php

Create user role with rights

Click on 'Add new role'.


Use role for archetype = 'No role'.


Click on 'Continue'.


Short name = ws_coachviewroll

Custom full name = Coachview web service role

Context types in which this role may be assigned = check system

Allow assignment of roles = Student (otherwise you can't enrol as a student)


Scroll down and fill in at 'Filter' one by one.


Note: the filter starts automatically, don't click enter.

  1. enrol/manual:enrol -> Login users; enable check box
  2. enrol/manual:unenrol -> Unsubscribe users from the course; allow check box
  3. moodle/cohort:assign -> Add and remove site group members; check Allow
  4. moodle/user:create -> Create users; allow checkboxes
  5. moodle/user:viewdetails -> View user profiles; enable check box
  6. moodle/user:viewalldetails -> View all user information; check Allow
  7. moodle/user:viewhiddendetails -> View hidden user details; enable checkboxes
  8. moodle/site:viewuseridentity -> View full user identity in lists; allow checkboxes
  9. moodle/course:useremail -> Enable/disable email addresses; enable checkboxes
  10. moodle/user:update -> Update user profiles; enable checkboxes
  11. moodle/course:view -> See courses without taking part; allow tick off
  12. moodle/role:assign -> Assign roles to users; enable check box
  13. webservice/rest:use -> Use REST protocol; enable check box

Click on 'Save changes'.

No needed: moodle/user:delete, moodle/cohort:view, moodle/course:viewparticipants,
/admin/roles/manage.php

Show user identity (showuseridentity)
vary rights

Show the identity of the user = Check Number (ID).

Click on 'Save changes'.


This will identify a participant from Coachview in Moodle.



/admin/settings.php?section=userpolicies
Link user role to user account
Click on the name 'Coachview webservice role'. Under 'Create user role with rights' this is the name that is filled in under 'Custom full name'.


Select 'Webservice Coachview' and click 'Add'.

/admin/roles/assign.php?contextid=1

New Custom (web) service creation and linking of web service functions
Click on 'Add'.

Name = Coachview webservice

Short name = ws_coachview

Enabled = tick

Authorized users only = check box


Click on 'Add service'.


/admin/settings.php?section=externalservices


Click on 'Functions' in the table.

Click on 'Add functions'.



Enter the following items one by one under 'Search' and click on <enter> each time to add them.
  1. core_cohort_add_cohort_members 
  2. core_cohort_delete_cohort_members
  3. core_user_create_users
  4. core_user_get_users_by_field
  5. core_user_update_users
  6. enrol_manual_enrol_users (not available in older Moodle versions)

Click on 'Add functions'.


Link user account to new web service

Click on 'Authorized users' in the same table.

Select 'Webservice Coachview' and click 'Add'.


/admin/settings.php?section=externalservices
Create token for the user account.
Click on 'Add' and fill in the following:

User (select from the list):
Webservice Coachview
Service (select from the list):
Coachview webservice
IP limiting:
  • For Coachview training: 212.83.209.208
  • For Coachview live: 212.83.209.198.
Valid until:
do not activate.

Click on 'Save changes'.

Return token to Coachview or add token via Service center in Coachview.

Debug messages turn on
Debug messages: none -> Developer (/admin/settings.php?section=debugging)
/admin/settings.php?section=webservicetokens
Set up additional customerfields. These can be used to display information from free fields, recorded in the personal file in Coachview.
Create a profile field there of the type 'text input'.

Fill in the Coachview free field code (=preference) for shortname. or choose your own code/name and fill in the same code/name.

In the Service Center of Coachview you can set which data has to be transferred.


/user/profile/index.php
AVGFrom Moodle version 3.3.5 onwards, have you set up the GDPR/AVG Privacy Tool?

If so, you must give your consent to the terms and conditions that have been set via Site Administration -> Privacy and Policy -> user agreements on behalf of the web service account.