I created a very simple test service here is the code, for some reason only GET works with it in Firefox Poster, but POST returns a 404 Controller not found. Any tips? Here is what works http://mysite.com/services/myendpoint/mytest/retrieve/

with parameter of id = 1


 * Implementation of hook_services_resources().
function mytest_services_resources() {
  return array(
   'mytest' => array(
     'retrieve' => array(
       'help' => 'Retrievs a test',
       'callback' => '_mytest_retrieve',
       'args' => array(
           'name' => 'id',
           'type' => 'int',
           'description' => 'The id of the test to get',
           'source' => array('path' => '0'),
           'optional' => FALSE,

 * Callback for creating  resources.
 * @param object $data
 * @return object
function _mytest_retrieve($id) {
  return "READY TESTING";


2 Answers 2


You need separate callbacks for each of the CRUD operations. You've only implemented 'retrieve', which is the GET callback, you need to implement a 'create' callback for POST to function.

Reading the docs really helps: https://drupal.org/node/783460

  • Thanks it took me a while to realize I needed an "Action" instead of a CRUD REST resource: drupal.org/node/783254 The best reference was the existing service calls for user, node and system...
    – giorgio79
    Sep 11, 2011 at 14:40
  • What are you trying to accomplish? An Action is used to modify a Resource overall, as in all resources of a given type (like a Content Type). A Targeted Action is used to modify "one field" of a multi-component (multi-field) an individual resource (like a single node), whereas the Update portion of the CRUD pattern is for modifying all the fields of an individual resource. Sep 11, 2011 at 15:06
  • All I want is that a user sends my site some text and I send back some data. No nodes, no CRUD, just spitting back some data based on some calcs. I managed to make this work via an action, and it works like magic. Thanks for the help.
    – giorgio79
    Sep 12, 2011 at 4:50
  • After a custom service, when I tried to access it, it return 404 error message. I've tried it even after clear the catch. How to make it work.
    – Guru
    Oct 3, 2016 at 17:18

you can't POST for any retrieve method.

Post is only for actions, and create methods.

you can read WAY more about it here. http://drupal.org/node/783254

  • Thanks Kyle, yes I found that post after I posted this question. Great stuff! I settled for now with a simple action. Love Services.
    – giorgio79
    Sep 12, 2011 at 4:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.