General developer forum

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

 
Picture of Lawrence Lagerlof
Local form plugin and exposing it's data (REST)
 

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: -
Picture of Olumuyiwa Taiwo
Re: Local form plugin and exposing it's data (REST)
 

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)
Picture of Lawrence Lagerlof
Re: Local form plugin and exposing it's data (REST)
 

"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.

 
Average of ratings: -