I'm doing this tutorial to get familiar with the concepts of the Services module. In that tutorial, you implement a custom service for the Services module. Therefore it uses hook_services_services
. But there are other tutorials (e.g. An introduction to Drupal 7 RESTful Services) that use hook_services_resources
for the same thing. So what is the difference?
1 Answer
The first article is incorrect, there is no hook_services_services()
(at least not according to any documentation for the services module, nor in my experience).
The correct hook to use is hook_services_resources()
. See the docs/services.services.api.php file included with the module for full details.
-
-
Also wrong - there is no
hook_services_services()
orhook_service()
in the Services module. That file doesn't even exist any more, those docs are woefully out of date– Clive ♦Feb 24, 2014 at 14:06 -
Could you please point me to a working example with detailed instructions? Whatever I try it doesn't work. I just can't find a working example. Feb 24, 2014 at 14:17
-
You'll find a working example in the module itself, in the docs/services.services.api.php file. I can confirm that example works perfectly, I've used it as a base for dozens of projects over the years– Clive ♦Feb 24, 2014 at 14:30