I have been working on upgrading my site form Drupal 7 to backdrop CMS. I have faced one problem where one of my custom modules is developed to generate resources for a REST endpoint. On drupal this was done by using the hook_services_resources(), but this does not seem to be the case under Backdrop CMS. So how do i generate the resources for this REST endpoint on Backdrop CMS. Any help will be appreciated! Thanks!  

Accepted answer

Hey @klonos, 

I figured out what I was doing wrong in generating those REST resources. In my hook.module file, I was calling an unavailable hook like hook_default_services_endpoint in Backdrop CMS. Also, my custom module has another file called the hook_services.inc where I have a valid hook, hook_services_resources(). I stopped using the hook_default_services_endpoint() hook and instead ported the functionality from the hook.services file which is  hook_services_resources(). After performing this hook function in the hook.module file and moving the functions in hook_services.inc to hook.module, the problem was fixed. 

Thanks! 

Comments

Hey @klonos, 

I figured out what I was doing wrong in generating those REST resources. In my hook.module file, I was calling an unavailable hook like hook_default_services_endpoint in Backdrop CMS. Also, my custom module has another file called the hook_services.inc where I have a valid hook, hook_services_resources(). I stopped using the hook_default_services_endpoint() hook and instead ported the functionality from the hook.services file which is  hook_services_resources(). After performing this hook function in the hook.module file and moving the functions in hook_services.inc to hook.module, the problem was fixed. 

Thanks! 

klonos's picture

Glad everything worked in the end @Venky, and thanks for taking the time to report back here 👍