there already are a lot of external functions available in moodle. You can bind/configure those functions in a moodle webservices.
How to do this you will find here: https://docs.moodle.org/37/en/Using_web_services
Maybe the following external functions are a good starting point for this what you want to do:
An overview of the available external functions can you find in your moodle installation: <your-moodle>/admin/webservice/documentation.php
A good example how to create a webservice client to access the moodle webservice is located here: https://github.com/moodlehq/sample-ws-clients
I think now you have a lot to do, good luck ;).