Moodle APIs for Courses and Enrollments

Launch can sync with Moodle LMS data via Moodle WebServices (APIs). The Launch application will sync course data, all courses in a “category”, and course rosters.

System requirements

Moodle version 3.2 or above.

These instructions were created using Moodle version 3.8. If your institution is using another version the following instructions might be slightly different for your particular version.

  1. Ensure the instance of Moodle is configured to use Web Services.

    • Access  Administration > Site administration > Advanced features

    • Check Enable web services, then click Save Changes

  2. Enable REST protocol.

    • Access Administration > Site administration > Plugins > Web services > Manage protocols

    • Enable REST Protocol

  3. Create an External Service.

    • Access Administration > Site administration > Plugins > Web services > External services

    • Under Custom Services, click Add:

      • Name: VitalSource

      • Short name: VST

      • Check Enabled

      • Check Authorised users only

      • Click the button 'Add service'

  4. Add functions to the External Service.

    • Search for and add the following functions to the External Service:

      • core_course_get_courses

      • core_course_get_courses_by_field

      • core_enrol_get_enrolled_users

      • core_course_get_categories
      • core_course_search_courses
    • Click Add functions

  5. Create a specific user for the External Service.

    • Site Administration > Users > Accounts > Add a new user

      • Enter the following information for the user:

      • Click Add

  6. Accept Privacy Policies for the user (if necessary).

    • Click on the new user and view their profile.

      • Under Privacy and policies click Policies and agreements (if this is not present, skip to the next step).

      • Click Accept → Give Consent for all policies and ensure all Responses are set to Accepted.

  7. Create a new role for the Web Service user

    • Site administration > User > Permissions

    • Click Define Roles

    • Click Add a new role

    • Click Continue (do not change any defaults)

    • Enter the following:

      • Short name: VitalSourceAPI

      • Custom full name: VitalSource API

      • Custom Description: VitalSource Web Service Integration

      • Context types where this role may be assigned: System

    • Under the permissions at the bottom of the page search for and click Allow for the following permissions:

      • Category

        • moodle/category:viewhiddencategories, See hidden categories

      • Course

        • moodle/course:view, View courses without participation

        • moodle/course:viewhiddencourses, View hidden courses

        • moodle/course:useremail, Enable/disable email address

        • moodle/course:enrolreview, Review course enrollments

      • User

        • moodle/user:viewdetails, View user profiles

        • moodle/user:viewhiddendetails, View hidden details of users

        • moodle/user:viewalldetails, View user full information

      • Activities

        • site:viewfullnames, Always see full names of users

        • moodle/site:accessallgroups, Access all groups

      • Web service; REST protocol

        • webservice/rest:use, Use REST protocol

  8. Add the new role to the created user.

    • Site Administration > Users > Permissions > Assign System Roles

    • Choose the VitalSource API role

    • Select the user created above in the Potential users column and click Add.

  9. Authorize a the user for the Web Service.

    • Administration > Site Administration > Plugins > Web services > External Services

    • Select Authorised users link (the service must have been set as Authorised users only in the Edit link)

    • Select the VitalSource user created in Step 3. and click Add.

  10. Create a Token for the Authorized User.

    • Administration > Site Administration > Plugins > Web services > Manage tokens

    • Click Add.

    • Select the created user and service

    • Click on Saves changes

  11. Email the Token to the VitalSource Integration Manager

Was this article helpful?