title: Error 400 in IONIC 3 when sending post to API on localhost of Django REST
body: <h2>Provider rest.ts</h2>
  
  <pre><code>import { HttpClient } from '@angular/common/http';
  import { Injectable } from '@angular/core';
  import { HttpHeaders } from '@angular/common/http/src/headers';
  
  @Injectable()
  export class RestProvider {
  
    apiUrl = 'http://127.0.0.1:8000'
  
    constructor(public http: HttpClient) {
      console.log('Hello RestProvider Provider');
    }
  
    getUsers() {
      return new Promise(resolve =&gt; {
        this.http.get(this.apiUrl+'/users/').subscribe(data =&gt; {
          resolve(data);
        }, err =&gt; {
          console.log(err);
        });
      });
    }
  
    addUser(data){
      console.log(JSON.stringify(data));
      return new Promise((resolve, reject) =&gt; {
        this.http.post(this.apiUrl+'/users/', JSON.stringify(data), 
        { headers: { 'Content-Type': 'application/json' } })
          .subscribe(res =&gt; {
            resolve(res);
          }, (err) =&gt; {
            reject(err);
          });
      });
    }
  
  }
  </code></pre>
  
  <h2>Page adduser.ts</h2>
  
  <pre><code>import { Component } from '@angular/core';
  import { IonicPage, NavController, NavParams } from 'ionic-angular';
  import { RestProvider } from '../../providers/rest/rest';
  
  @IonicPage()
  @Component({
    selector: 'page-adduser',
    templateUrl: 'adduser.html',
  })
  export class AdduserPage {
  
    user = { email: '', groups: { url: '', name: '' }, url: '', username: ''};
  
    constructor(
      public navCtrl: NavController, 
      public navParams: NavParams,
      public restProvider: RestProvider) {
    }
  
    ionViewDidLoad() {
      console.log('ionViewDidLoad AdduserPage');
    }
  
    saveUser(){
      console.log(this.user);
      this.restProvider.addUser(this.user).then((result) =&gt; {
        console.log(result);
      }, (err) =&gt; {
        console.log(err);
      });
    }
  }
  </code></pre>
  
  <h2>Page adduser.html</h2>
  
  <pre><code>&lt;ion-content padding&gt;
    &lt;h2&gt;Add User&lt;/h2&gt;
    &lt;form (ngSubmit)="saveUser()"&gt;
      &lt;ion-item&gt;
        &lt;ion-label&gt;Username&lt;/ion-label&gt;
        &lt;ion-input type="text" [(ngModel)]="user.username" name="username"&gt;&lt;/ion-input&gt;
      &lt;/ion-item&gt;
      &lt;ion-item&gt;
        &lt;ion-label&gt;Email&lt;/ion-label&gt;
        &lt;ion-input type="email" [(ngModel)]="user.email" name="email"&gt;&lt;/ion-input&gt;
      &lt;/ion-item&gt;
      &lt;button ion-button type="submit" block&gt;Add User&lt;/button&gt;
    &lt;/form&gt;
  &lt;/ion-content&gt;
  </code></pre>
  
  <hr>
  
  <p>This error appears when I try to do a POST:</p>
  
  <pre><code>HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "Bad Request", url: "http://127.0.0.1:8000/users/", ok: false, …}
  error
  :
  groups
  :
  Array(1)
  0
  :
  "Hyperlink inválido - Sem combinação para a URL."
  length
  :
  1
  __proto__
  :
  Array(0)
  __proto__
  :
  Object
  headers
  :
  HttpHeaders {normalizedNames: Map(0), lazyUpdate: null, lazyInit: ƒ}
  message
  :
  "Http failure response for http://127.0.0.1:8000/users/: 400 Bad Request"
  name
  :
  "HttpErrorResponse"
  ok
  :
  false
  status
  :
  400
  statusText
  :
  "Bad Request"
  url
  :
  "http://127.0.0.1:8000/users/"
  __proto__
  :
  HttpResponseBase
  </code></pre>