### Build plugins A plugin is a basic python function that takes positional arguments i.e one being request and the other config. We allow the function to have access to the request object (if data were submitted) and to QCMS configuration if any configuration data is needed.
# saving this function to www/html/_plugins/myplugins.py # import numpy as np import cms @cms.Plugin(mimetype="application/json", methods=["POST"]) def demo(**_args): req = _args['request'] conf= _args['config'] return {"name":"foo","age":np.random.randint(0,100)}
### Register Plugin Once a plugin is build it needs to be registered, in order to allow the function be made available to calling code (JS/HTML5)
$ qcms plugin-register qcms-manifest.json myplugins.py --import demo
Calling the registered function as an API. The example uses curl
$ curl http://localhost:8000/api/myplugins/demo
### Limitations **QCMS** lowers the barrier to entry and makes the following tradeoffs to deliver an optimal solution: