Using web services - MoodleDocs (2024)

This document explains how an administrator can set up a web service for users to access a service. Each user will have a specific and unique security key (also known as a "token") to access the service.

Contents

  • 1 Enabling web services
  • 2 Enabling protocols
  • 3 Enabling web service function documentation
  • 4 Creating a custom external service
  • 5 Adding functions to the service
  • 6 Enabling capabilities
  • 7 Alternative settings
    • 7.1 Authorise only specific users
    • 7.2 Create a token
    • 7.3 See also

Enabling web services

Enabling web services

  1. Access Administration > Site administration > Advanced features
  2. Check 'Enable web services' then click 'Save Changes'

Note: For security reasons, web services should only be enabled if you intend to make use of it.

Enabling protocols

Usually external applications that users wish to use dictate which protocols should be enabled.

  1. Access Administration > Site administration > Server > Web services > Manage protocols
  2. Enable the protocols (SOAP, REST, XMLRPC, AMF, ...) as required

Enabling web service function documentation

Security keys page with documentation link

Enabling web service function documentation (also on the Manage protocols page) results in user-specific web service documentation being available for each user on their Security keys page. This option is mainly useful to web service client developers. If nobody is creating a web service client, there is no need to enable this feature.

Creating a custom external service

If none of the pre-build web services match your needs, you can create a custom service i.e. select which of the standard web service functions are available via that service.

You can enable only the specific functions that you need to expose, so not compromising on security.

  1. Access Administration > Site administration > Server > Web services.
  2. Click Add new custom service
    • 'Authorised users only' - If enabled, you will need to select the authorised users manually. Otherwise all users with appropriate permissions are allowed
    • 'Required capability' - If enabled, any user accessing the web service will be checked against this selected capability. (This is just an additional optional security layer.)
  3. Enter a name and check Enabled
  4. Click the button 'Add service'

Adding functions to the service

Adding functions to the service

Your service is currently empty and doesn't do anything. Web service functions need to be added. Your choice will be dictated by what you allow the external application to do. For this example, select 'Create group'.

  1. Click 'Add functions' link
  2. Select 'create group' function and click the 'Add functions' button

Note that deprecated functions can not be added to services although the ones that are already part of a service can remain there until they are removed from Moodle codebase.

You should be back to the service functions list. 'Required capabilities' are indicated for each function. Users need the required capabilities to run a function. The function descriptions in the API Documentation can also give you more information about the required capabilities (Administration > Site administration > Server > Web services > API Documentation).

Enabling capabilities

The final step is to grant appropriate permissions. The following capabilities should be allowed:

  • moodle/webservice:createtoken - for allowing users to generate a security key
  • webservice/rest:use, webservice/soap:use, webservice/xmlrpc:use, webservice/amf:use which match the enabled protocols.
  • The service Required capability if set (Administration > Site administration > Server > Web services > Manage services >Edit link).
  • The required capabilities for the web service functions. These required capabilities are listed when you add a function to the service. For more information about roles and capabilities, read the Manage roles documentation.

Once done, the web service should be set up. Users should be able to obtain a personal security key.

Authorise only specific users

  1. Administration > Site Administration > Server > Web services > External Services
  2. Select Authorised users link (the service must have been set as Authorised users only in the Edit link)
  3. Select some users and click Add

Moodle indicates if some capabilities need to be assigned to an authorised user. Moreover, if you click on the authorised user fullname, you can set up some specific options: IP restriction and Valid until.

Create a token

This feature allows you to create a token for specific user. It can be useful if a user doesn't have the moodle/create:token capability. This is also the only way to create a token for an administrator. For security reason, tokens are not automatically generated in the administrator security keys page.

  1. Administration > Site Administration > Server > Web services > Manage tokens
  2. Click on Add
  3. Select the created user and service
  4. Click on Saves changes

As you created a token for this user, you do not need to assign "moodle/webservice:createtoken" to him/her.Finally, note that, as for authorised users, you can also set IP restriction and Valid until on a token.

See also

Using web services - MoodleDocs (2024)
Top Articles
New Laine’s Letter About Saving Money
TradeHero (Free, iOS and Android) is a stock exchange game that teaches you how to invest in a virtual environment.
Www.mytotalrewards/Rtx
Katie Pavlich Bikini Photos
Koopa Wrapper 1 Point 0
Napa Autocare Locator
Ds Cuts Saugus
Polyhaven Hdri
Https //Advanceautoparts.4Myrebate.com
Housework 2 Jab
Dump Trucks in Netherlands for sale - used and new - TrucksNL
Grace Caroline Deepfake
WEB.DE Apps zum mailen auf dem SmartPhone, für Ihren Browser und Computer.
Uconn Health Outlook
Faurot Field Virtual Seating Chart
Walmart Car Department Phone Number
Wemod Vampire Survivors
Sadie Sink Reveals She Struggles With Imposter Syndrome
Defending The Broken Isles
Craigslist Apartments In Philly
Helpers Needed At Once Bug Fables
fft - Fast Fourier transform
Urbfsdreamgirl
Claio Rotisserie Menu
Temu Seat Covers
O'reilly's In Mathis Texas
Effingham Daily News Police Report
Pacman Video Guatemala
Mercedes W204 Belt Diagram
What Is The Lineup For Nascar Race Today
A Grade Ahead Reviews the Book vs. The Movie: Cloudy with a Chance of Meatballs - A Grade Ahead Blog
Old Peterbilt For Sale Craigslist
Goodwill Thrift Store & Donation Center Marietta Photos
Google Jobs Denver
Mckinley rugzak - Mode accessoires kopen? Ruime keuze
Empires And Puzzles Dark Chest
Gt500 Forums
Trivago Anaheim California
Stranahan Theater Dress Code
4k Movie, Streaming, Blu-Ray Disc, and Home Theater Product Reviews & News
What Is The Optavia Diet—And How Does It Work?
Lawrence E. Moon Funeral Home | Flint, Michigan
Dagelijkse hooikoortsradar: deze pollen zitten nu in de lucht
The top 10 takeaways from the Harris-Trump presidential debate
How to Do a Photoshoot in BitLife - Playbite
Lux Funeral New Braunfels
O.c Craigslist
The Missile Is Eepy Origin
Bellin Employee Portal
Qvc Com Blogs
Latest Posts
Article information

Author: Annamae Dooley

Last Updated:

Views: 5680

Rating: 4.4 / 5 (45 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Annamae Dooley

Birthday: 2001-07-26

Address: 9687 Tambra Meadow, Bradleyhaven, TN 53219

Phone: +9316045904039

Job: Future Coordinator

Hobby: Archery, Couponing, Poi, Kite flying, Knitting, Rappelling, Baseball

Introduction: My name is Annamae Dooley, I am a witty, quaint, lovely, clever, rich, sparkling, powerful person who loves writing and wants to share my knowledge and understanding with you.