Service Module and REST: 404 Not found

We encourage users to post events happening in the community to the community events group on https://www.drupal.org.
klimpab's picture

Hello! I hope that this is the right place.

I strictly followed this guide. The REST Server is activated. I try to access http://localhost/rest/user/token.json (the Drupal installation is at localhost) via the Firefox REST Easy Add-On. No success. It always gives me a "404 Not Found" error.

Under the "Resources" Tab of the Service Module configuration, all resources are enabled. What am I doing wrong?

Comments

Hi, When calling "services"

Sebastien M.'s picture

Hi,

When calling "services" you must use "POST" method.
I've just tested it under "Rest Console" with Chrome and it's ok. I obtained successfully a new token.
For security reason Drupal seems to respond a 404 error instead on 403 (not authorized) or 400 (bad request).

Otherwise Have you tried to enable the service which is provided with commerce akeneo module ?

The Commerce Akeneo module

lhridley's picture

The Commerce Akeneo module has absolutely nothing to do with the original question.

My fault. Sorry, but the

Sebastien M.'s picture

My fault. Sorry, but the answer is the same, you should "POST" to obtain a token.

Or GET

tyler.frankenstein's picture

Alternatively you can use a GET on ?q=services/session/token to retrieve the X-CSRF-Token.

Already did this?

klimpab's picture

@Sebastien I guess this is what I already did. Still no token. Look at the screenshot (note that I changed the site's local domain to drupaltest, which should not matter).

As @Sebastien points out, you

nakeddesign's picture

As @Sebastien points out, you should you POST rather than GET. I'd also recommend testing with security disabled first.

Tried that

klimpab's picture

@nakeddesign I tried it both, with POST and GET (plus the query). Sorry, the screenshot is a bit confusing.

What do you mean with "security disabled"?

You should test by setting

Sebastien M.'s picture

You should test by setting those headers in the request:

Accept: application/json
Content-Type: application/json

Doesn't work.

klimpab's picture

@Sebastien: Tried that. No chance. See the screenshot.

issue with services module

veso_83's picture

Hi guys,
I was hopping I can find some assistance here, I'm trying to implemet commerce_akeneo using services. I've set up the akeneo module and servies on the akeneo platform I'm trying to export products initially but when I hit export it's failling with an error:
CTUALYS_DRUPAL_COMMERCE_CONNECTOR.STEPS.ACTUALYS\BUNDLE\DRUPALCOMMERCECONNECTORBUNDLE\WRITER\PRODUC

Client error response
[status code] 403
[reason phrase] : Access denied for user anonymous
[url] my_site/akeneo/user/token

So basically this url is failling for anonymous users even if I give permissions to all services for anonymous users

Can you give an advice?

Services

Group organizers

Group categories

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week