Local form plugin and exposing it's data (REST)

Local form plugin and exposing it's data (REST)

by Lawrence Lagerlof -
Number of replies: 2

The current situation:

  • I created a local plugin. This plugin is a simple form that inserts records to a custom table. It extends the moodleform class (let's call it MYFORM).
  • I created other plugin, a webservice that extends the external_api class (let's call it MYWEBSERVICE). I am stating this just to be clear on what I have done previously.
Both plugins are working fine.

The problem:
In MYFORM plugin I need to expose the data of my new tables as a REST webservice, independently. So I can't use MYWEBSERVICE to expose this data in particular.
Since MYFORM plugin is based on moodleform class, exist some way I could expose the data without creating another webservice plugin?



Average of ratings: -
In reply to Lawrence Lagerlof

Re: Local form plugin and exposing it's data (REST)

by Olumuyiwa Taiwo -
Picture of Plugin developers

You can add web service function(s) to MYPLUGIN plugin -- https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin

Average of ratings: Useful (1)
In reply to Olumuyiwa Taiwo

Re: Local form plugin and exposing it's data (REST)

by Lawrence Lagerlof -

"Exposing functions as Web service functions is done in one file called services.php".

I wasn't aware that I could use the services.php in non external_api plugins.

Thank you.