Question: I am developing an app communicating with a server Api. I test api using post man 
but when I call it from project not success, there is no issue cross site on server

I want correct way to call api.
you can use this token :

```
slaLpDPAKjPa3AKs28BfALRitc2H255c-KFw4Jk1R61E7vtu3hjoHUTlasgpb8J6OCbJ8MQyAJWALM9FCLktsxs1M0rGFpO7hnLhBTwRVLNn0Ctcq6mhUiJ1GZ2xGDgvNoHvYtb1omwNwVHZCOCx0zEJao8AZxE7SowxpYyYsVWYpcdjyziSVri2isNFn-8zCFlhfpgY4mjwJMkE5dUPEW_t-ixH_N3M2MIuO0kslTzFiuj-v4bSllcCM3XeEBt9hj6GI3-JvcrOx3edmA3yXhmK52h2AbYAjO_QZxIbbKM

```

here is my function:

```
addRabbit(position: number, Token: string): Observable<any> {
    let myHeaders = new Headers();
    myHeaders.append('Content-Type', 'application/json'); 
    myHeaders.append('Authorization', 'bearer ' + Token); 
    let myParams = new URLSearchParams();
    myParams.append('PositionId', position);
    let options = new RequestOptions({ headers: myHeaders, params: myParams });
    return this.http.post('http://abdalrahmannada-001-site1.htempurl.com/api/Rabbit/AddRabbit',
        options).map(res => res);

} 

```

Answer: 
Use this code. it is working fine for me. Change the parameters according to your requirments.

```
public http: Http

```

in constructor

```
 getDataPostAuth(url, body) {
return new Promise((resolve, reject) => {
  let headers = new Headers({ 'Content-Type': 'application/x-www-form-urlencoded' });
  let options = new RequestOptions({ headers: headers });
  options.headers.set('Content-Type', 'application/json');
  options.headers.set('Authorization', 'Bearer ' + localStorage.getItem("token"));
  this.http.post(this.MainURL + url, body, options)
    .subscribe(res => {
      resolve(res.json());
    }, (err) => {
      reject(err);
    });
});

```

}

For URLSEARCHPARAM

```
import { Http, Headers, URLSearchParams, Request, RequestOptions, RequestMethod } from '@angular/http';
 let headers = new Headers();
    headers.append('HeaderKey', HeaderValue);
    headers.append('HeaderKey',HeaderValue);
    let params: URLSearchParams = new URLSearchParams();
    params.set('paramKey', paramValue);
    params.set('paramKey', paramValue);
    let options = new RequestOptions({
      method: RequestMethod.Post,
      url: this.global.yourAPIurl+ extended URL+"parameters you want to pass",
      search: params,
      body: this.yourBody,
      headers: headers
    });
    this.http.request(new Request(options))
      .map(res => res.json())
      .subscribe(data => {
}, err => {
        console.log("ERROR!: ", err);
      });

```
First of all bearer is in lowercase, it shall be as follows

```
myHeaders.append('Authorization', 'Bearer ' + Token); 

```