I am testing the REST API, with the REST UI module installed on Drupal version 8.6.9.

In Postman, using the POST method (http://www.domain.com/user/login?_format=json), I get the following error.

Symfony\Component\HttpKernel\Exception\NotAcceptableHttpException: Not acceptable format: json

I also tried the user registration URL (http://www.domain.com/user/login?_format=json&mail=testing%40domain.com&pass=123456), but I get the following error.

Symfony\Component\Serializer\Exception\NotEncodableValueException: Syntax error in Symfony\Component\Serializer\Encoder\JsonDecode->decode()

Is there anything missing, as I am using the 8.6.9 version with Composer installed?


I tested using POST :


and post data :

{"name":"dev","pass":"123456","form_id": "user_login_form"} 

and added

content-type: application/x-www-form-urlencoded 

but its returning HTML,

> <!DOCTYPE html> <html> <head> <meta charset="UTF-8" /> <meta
> http-equiv="refresh" content="0;url=/dashboard" /> <title>Redirecting
> to /dashboard</title> </head> <body> Redirecting to <a
> href="/dashboard">/dashboard</a>. </body> </html>
  • As side note, /user/login requires username and password. Since the format is JSON, you need to pass a JSON object. – kiamlaluno Feb 17 at 8:36
  • The registration route is /user/register, but it requires more than just email and password. – kiamlaluno Feb 17 at 9:36
  • I tried using postman with the username and password given method post and param but its still not working, it throws out that error @kiamlaluno – Boby Feb 17 at 16:24
  • I don't believe core rest module supports user/login because "login" has no meaning in "restful". – mradcliffe Feb 17 at 21:48
  • Possible duplicate of User login REST format – mradcliffe Feb 17 at 21:50

Your Answer

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

Browse other questions tagged or ask your own question.