title: Http service POST
body: <p>I have this GET data (http service) in my application on angular 2:</p>
  
  <pre><code>    private _url = "http://10.77.7.77/monitoring/api/v1/services/list";
  
      constructor(private _http: Http) {
  
      }
  
      getServices(): Observable&lt;any&gt; {
          return this._http.get(this._url)
              .map(res =&gt; res.json());
      }
  </code></pre>
  
  <p>And everything is OK, but now my task is create a POST data, with another URL: </p>
  
  <pre><code>private _url2 = 'http://10.77.7.77/monitoring/api/v1/action/stop';
  </code></pre>
  
  <p>id - number of service this json:</p>
  
  <pre><code>[{
  "nodename": "10.46.2.152",
  "servicelist": [{
      "id": "3827aa4b204fc2e122f452c1c1ceeaf15109364698d5d0f2153efa6e9487a968",
      "name": "Nginx",
      "status": "Online",
      "servicecontrolled": true
  }]
  </code></pre>
  
  <p>I wrote this POST data:</p>
  
  <pre><code>postServices(post: { title: string, status: string, id: number }): Observable&lt;any&gt; {
          let _url3 = `${this._url2}/${post.id}`
          let headers = new Headers();
          headers.append('Content-Type', 'application/json');
          const body = JSON.stringify(post);
          return this._http.post(_url3, body, post)
              .map(res =&gt; res.json())
      }
  </code></pre>
  
  <p>with this event </p>
  
  <pre><code>onPost(title: string, body: string, id: string) {
    this._service.postServices({title: title, body: body, id: +id})
      .subscribe(
        response =&gt; this.response = response,
        error =&gt; console.log(error)
      );
  }
  </code></pre>
  
  <p>and this my template:</p>
  
  <pre><code>&lt;button *ngIf="!!service_rec.servicecontrolled" 
  [style.background-color]="service_rec.controlled 
   == 'true' ? 'green' : 'orange'"
   class="btn btn-warning"
   (click)="onPost()"&gt;
   {{ service_rec.servicecontrolled | json | toOnOff }}
   &lt;/button&gt;
  </code></pre>
  
  <p>And now i have some error <code>500 (Internal Server Error)</code></p>