1

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

Varun Sreedharan
  • 517
  • 8
  • 28
  • Have you added the description of the function in db/services.php ? (I have done that but I am getting the same error message.) Did you solve this issue? If you did, it would be really helpful if you posted the answer here. – Yvonne Aburrow Sep 05 '16 at 08:36
  • 1
    Hi Yvonne , If we made any changes inside service module , need to update the db , so after editing the service module save the file and login the moodle once more . So we got the option for updating the DB.it will take some minutes , After the updations all the functions we can use .Can u try this – Varun Sreedharan Sep 05 '16 at 08:41

1 Answers1

2

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

Yvonne Aburrow
  • 2,602
  • 1
  • 17
  • 47