2

I have an endpoint, which is active and working for more than a year, and I recently had the need to add a new endpoint, which obviously has a different url ("Path to endpoint").

For both, however, I need to use the login functionality, and other custom actions (each one has its own url, callback and access callback, in two separated custom modules).

But on every call, i can see that both endpoints are being requested, all arguments are being doubled etc. Here's the $controller as seen from hook_services_request_preprocess_alter:

Array
(
    [help] => Array
        (
            [0] => Description from endpoint 1
            [1] => Description from endpoint 2
        )

    [callback] => Array
        (
            [0] => MY_FIRST_MODULE_callback_function
            [1] => MY_SECOND_MODULE_callback_function
        )

    [access callback] => Array
        (
            [0] => MY_FIRST_MODULE_access_callback_function
            [1] => MY_SECOND_MODULE_access_callback_function
        )

    [args] => Array
        (
            [0] => Array
                (
                    [name] => email
                    [type] => string
                    [description] => Email
                    [source] => Array
                        (
                            [data] => email
                        )

                    [optional] => 1
                )

            [1] => Array
                (
                    [name] => email
                    [type] => string
                    [description] => Email
                    [source] => Array
                        (
                            [data] => email
                        )

                    [optional] => 1
                )

        )

    [etc] => ....

)

This happens whichever url is requested, it's causing both the iOS and Android apps to crash, and i couldn't find a way around it.

What should / can I do to run both endpoint independently, and why are both getting invoked even if the url ("Path to endpoint") is different?

1 Answer 1

2

Use a distinct resource name, or simply enable the same resource on the other services endpoint to use it there.

To debug issues with the controller, you can check in RESTServer.inc in particular the functions getController and resolveController. Adding some debug/logging code there may help to resolve the issue.

4
  • thanks for your reply. i'm already using distinct resources names for the custom actions, but i can't rename the /user/ actions... and both endpoints have all required resources enabled.
    – Giona
    Sep 30, 2016 at 11:41
  • @Giona: That's curious, perhaps some odd configuration there. Please see my updated answer with more debug info. Sep 30, 2016 at 12:20
  • 1
    Thanks @David Thomas, debugging there led me to the actual problem: in the new endpoint, i had both the old and the new resources list enabled, and disabling the old ones fixed the issue. I still don't get why they should be there as the endpoint path is completely different, but whatever, it works now! Thanks a lot.
    – Giona
    Sep 30, 2016 at 13:03
  • @Giona, glad to hear it! all the best. Sep 30, 2016 at 13:23

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.