Skip to main content
5 of 11
added 206 characters in body
No Sssweat
  • 31.6k
  • 14
  • 55
  • 91

'Content-Type': 'application/json' needs to be 'Content-Type': 'application/hal+json' in order for it to work.

I recommend you watch these video tutorials

Learn Drupal 8 - REST API Part1

Learn Drupal 8 - REST API Part2

The login is covered in part 2, but part 1 is very informative and part 2 will make more sense if you watch part 1.

Although, the video tutorial uses the Google Chrome Postman add-on, your code needs to do the same.

  1. Have a header with Content Type and Authorization

  2. Your URL to POST, GET, or PATCH shouldn't be your user page, unless you're updating the user fields. The URL needs to be whatever page you want to POST, GET or PATCH.

Ex: http://forexample.com/node/1

No Sssweat
  • 31.6k
  • 14
  • 55
  • 91