Moodle has a basic API which can be accessed through a webservice. The functions for the grading API appear to be in /lib/classes/grading_external.php
Some webservices documentation can be found here: https://docs.moodle.org/dev/Web_services
It's not for the faint hearted, but it's the official way of communicating with Moodle from an external system.