`'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 ](https://www.youtube.com/watch?v=DnZo5lMICKc) 

[Learn Drupal 8 - REST API Part2](https://www.youtube.com/watch?v=Wxoty5nX7BQ)

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][1] add-on, your code needs to do the same. 

1) Have a header with Content Type and Authorization

2) 

> `GET http://{my-host}/user/testing`

Your URL to POST, GET, or PATCH shouldn't be your user page, unless you want to work with the user fields. The URL needs to have the entity you are working with. 

For example: See the url's used in the video tuts.

You can even use [Postman][1] to generate your code

This is the PHPV1 generation, you can also generate for other languages like Python, jQuery, PHP Curl to name a few. 

    <?php
    
    HttpRequest::methodRegister('PATCH');
    $request = new HttpRequest();
    $request->setUrl('http://forexample.com/node/1');
    $request->setMethod(HttpRequest::HTTP_METH_PATCH);
    
    $request->setHeaders(array(
      'postman-token' => '9656f5e8-13a5-0e2b-23cb-5ac03af59b5b', // remove this line
      'cache-control' => 'no-cache', // remove this line 
      'authorization' => 'Basic Q2FtaWxvOmNvY29saXNv',
      'content-type' => 'application/hal+json'
    ));
    
    $request->setBody('{
    "title": [
    {
    "value": "The title changed, WOOOHOOO!!!"
    }
    ],
    "type": [
    {
    "target_id": "article"
    }
    ],
    "_links": {
    "type": {
    "href": "http://forexample.com/rest/type/node/article"
    }
    }
    }');
    
    try {
      $response = $request->send();
    
      echo $response->getBody();
    } catch (HttpException $ex) {
      echo $ex;
    }


  [1]: https://www.google.ca/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwjYx4Pupa7MAhUYwGMKHdLbA8cQFggcMAA&url=https%3A%2F%2Fchrome.google.com%2Fwebstore%2Fdetail%2Fpostman%2Ffhbjgbiflinjbdggehcddcbncdddomop%3Fhl%3Den&usg=AFQjCNE_Yq59TT1ZExzJ68FTldg4ho_lGw&sig2=oBd2GEaCZW4jYS-DD6fnUw