1

This really is two issues, but possibly both are related.

Main issue:

I have a custom resource setup in Services, the endpoint seems to be "mostly" working. The endpoint is api/ada/ and my resource is named "assessment", so when I go to mydomain/api/ada/assessment/retrieve, it works. I have an arg setup which is the assessmentID to retrieve and I'm returning a json array with just that ID for my test.

When I set the arg source to array('path'=>'0') it works, but the ID value in the json aray is the word 'retrieve'. When I set the path to '1' and go to mydomain/api/ada/assessment/retrieve/1 I get a "Controller not found" error in my console (using Chrome).

Secondary, but possibly related:

I have my custom module info file setup with files[] = includes/my_module.inc which doesn't seem to work, so my callback in the above has to be in the same file for it to work. When I try to require 'includes/my_module.inc' or do module_load_include(...) it's outputting the file contents onto the screen rather than including them. I'm certain this is an IIS config issue, but you'd think other modules would be doing this, but it's not, I get no other errors (or this type of output) across the site, though I'm less certain of that.

Anyway, I've setup a work-around using the hook_menu() functionality and setting up an "api" of sorts so I can build out the functionality while I recover from bashing my head on the desk trying to figure this endpoint issue out, but I get the module_load_include(...) error in this method as well, so I'm thinking maybe it's not entirely an issue with the Services Module.

Any help is greatly appreciated!

Link to code

  • Can you post your code? – heshanlk Nov 10 '14 at 16:45
  • @heshanlk - edited post to add link at bottom. – dpgtfc Nov 10 '14 at 17:20
  • In your case the path should be 'path' => 0 – heshanlk Nov 11 '14 at 17:34
1

In your case the path should be 'path' => 0, because it is the first argument after the endpoint url. Currently you have 1 and it will look for undefined argument which will end up with an exception.

For more information read services oop to get a better understanding in an OOP way. https://github.com/hugowetterberg/services_oop

  • I've tried the 'path' => 0 and the value it passes as a parameter is 'retrieve' which is why I tried 1, since it follows retrieve. However, when path is 0, it still returns a Controller not found error when I add a number to the url. – dpgtfc Nov 12 '14 at 18:31
  • strange, try settings the 'optional' => FALSE. I think the controller not found could be the router doesn't work for the optional arguments. – heshanlk Nov 13 '14 at 19:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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