General developer forum

Creating an interaction with Moodle and an External Web Service

 
Picture of Chris Swinney
Creating an interaction with Moodle and an External Web Service
 

Hi All,

I'm pretty new to moodle but I think my request should be doable. We are creating a middleware platform that will enable some resource to be available (specifically compute resources in AWS). Essentially this middleware platform will be controlled via a REST API that would then initiate the creation of the compute resources, with further APIs to allow the control and configuration of those resources. The purpose being that a Moodle user will be presented a scenario as an activity, and will then be able to launch a live lab in AWS based on that scenario. Different user should have their own AWS instances, and be able to return to them.

At the same time, we need to feedback some information to the user generated from the middleware/AWS, such as the IP address of the Compute Resource, passwords/username for the instance, etc. I would like this information to be added to the scenario activity for the user, although I’m not sure if we would store this somehow in the user’s Moodle account or fetch it each time the user logs on. I think if we stored it in a user’s account, we would need to interact with the Moodle Page or Messages API to write this information (or perhaps just store as a File), but not 100% sure. Ideas welcome.

I envisage that as AWS compute time costs money, that we will need to somehow be able to put the compute resource to sleep. I think the simplest thing here is to send a request when the user logs out of Moodle, either actively or via a session time out, or send keep alives and if that keep alive is not received by the middleware (say the user has put their laptop to sleep) then the middleware suspends the instances after a timeout.

 

I guess this will be wrapped up in some kind of plugin. So, ideas welcome ?.

Cheers

 
Average of ratings: -
Picture of Chris Swinney
Re: Creating an interaction with Moodle and an External Web Service
 

FWIW, as a basic answer to my own question (in the hope that this might help others), we have used the Webhooks plugin that give us some basic functionality. Now, the very act of a user viewing a page "hooks" into our middleware web services that allow us to do something. We can use the parameters passed by Moodle (specifically things like page reference ID and user ID) to enable us to perform a specific action. 

I'm sure there are better ways to do this but this is a start.

Figuring out plugins will likely be on the cards at some point, 

 
Average of ratings: -