1

I have Drupal 7 with web services activated, but the system/connect resource returns a 404 Controller Not Found response. I was trying the user resource, and it works correctly. I tried using the following URL in my browser window, which does a HTTP GET:

https://localhost/drupal/x_login/system/connect

where x_login is the endpoint.

4
  • You should post more information in your question such as the http request and response headers. Are you trying GET when it is supposed to be a POST? Returning nothing sounds like you have custom code doing something weird. If the controller isn't enabled, you'll get a 404. If you're not authorized, a 403.
    – mradcliffe
    Commented May 11, 2017 at 1:59
  • The answer is a blank page, and the headers show the next error: 404 Not found: Could not find the controller
    – Dyn
    Commented May 11, 2017 at 2:30
  • Are you doing a GET or a POST?
    – mradcliffe
    Commented May 11, 2017 at 13:41
  • I am making the request by pasting the address of the service in the browser url, and in the headers of the request refers as request method "GET"
    – Dyn
    Commented May 11, 2017 at 15:37

1 Answer 1

0

The services module allows a resource to define the following "things":

  1. Operations: provide 5 different verbs
    • retrieve: Make a GET request based on the resource name and an identifier i.e. GET /endpoint/user/ID
    • index: Make a GET request based on the resource name to get a list of resources i.e. GET /endpoint/user
    • update: Make a PUT request to a resource name and an identifier i.e. PUT /endpoint/user/ID
    • create: Make an idempotent POST request to a resource name to create a new resource i.e. POST /endpoint/user
    • delete: Make a DELETE request to remove a resource by identifier i.e. DELETE /endpoint/user/ID
  2. Actions: Allows to make a custom POST request to a resource. This is used for login, logout, etc... These are never GET.
  3. Targeted Actions: Allows to make a custom POST request to a resource + identifier. This is used for making hierarchical resources.
  4. Relationships: Allows to make a custom GET request to a resource + identifier. This is used for make hierarchical requests for things like group membership.

The system/connect resource is defined as an "action" above. This means that you must make a POST request instead of a GET request. And it may require a CSRF Token.

POST /login_x/system/connect HTTP/1.1
Content-type: application/json
Accept: application/json
X-CSRF-Token: 'TOKEN'

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.