1

I try to create a node via a rest POST over Chrome's Postman using Drupal 8.2.3., but i always get a 403 access denied.

Can anyone point out a step-by-step how-to on the settings? Mainly regarding the permissions that need to be set accordingly.

I did obtains the token at /rest/session/token and added into the request header.

The Request was: MYURL.de/rest/node?_format=json. For your information: I created the service-endpoint /rest, and I also tried with: MYURL.de/node?_format=json, but the same result.

Can anyone drop me a hint?

6
  • I have the same 403 drupal.stackexchange.com/questions/221880/… Commented Dec 1, 2016 at 9:36
  • Can you post the details of the http request you made?
    – Jimmy Ko
    Commented Dec 1, 2016 at 10:47
  • You should obtains the token from /rest/session/token first and add it in request header X-CSRF-Token: [token]
    – Jimmy Ko
    Commented Dec 1, 2016 at 10:48
  • I did that all! Including the Token. The Request was: MYURL.de/rest/node?_format=json For your information: I created the service-endpoint "/rest" But i also tried with: MYURL.de/node?_format=json Same result :/
    – Fab
    Commented Dec 1, 2016 at 15:04
  • uhmmm - no updates on this?
    – Fab
    Commented Dec 2, 2016 at 10:27

1 Answer 1

2
  • Your request need ?_format=json on the end of request.

  • Clear cache.

  • Delete all sessions, delete from sessions.

  • Call login service, /user/login?_format=json, method POST choose raw in Body and there put username and password in JSON format:

    {
       "username": "value",
       "password": "value",
    }
    

    and choose JSON (application/json).

    This service will return X-CSFR-TOKEN, use it for your request.

1
  • In my case was proxy the problem. Go to Settings > Proxy > Use system proxy (must be off) Commented Jul 24, 2019 at 14:21

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