moodlemoodle-apimoodle-mobile

Moodle custom service creation issue


I am trying to create Moodle custom service for my functionality enhancement

1 ) https://docs.moodle.org/dev/External_functions_API
2 ) https://docs.moodle.org/dev/Adding_a_web_service_to_a_plugin

updated service module based on these documents.created service module and external_lib.php file. But i got error while accessing the web service API

Error : {"exception":"dml_missing_record_exception","errorcode":"invalidrecord","message" :"Can not find data record in database table external_functions."}

Enabled debug mode and tried again . It shows external function registration error .

{"exception":"dml_missing_record_exception","errorcode":"invalidrecord","mess    age"
:"Can not find data record in database table     external_functions.","debuginfo":"SELECT * FROM {external_functions
} WHERE name = ?\n[array (\n  0 => 'local_enroll_course',\n)]"}    

How can i register newly created service inside Moodle ? Pls Help


Solution

  • You need to increment your version number in version.php and go to Notifications in Moodle and run an upgrade. Then Moodle will recognise the new function that you have added into externallib.php and db/services.php