# Argument of type '{headers:Headers;}' is not assignable to parameter of type 'RequestOptionsArgs'.Property 'null' is missing in type '{headers:Headers;}'

**URL:** <https://forum.ionicframework.com/t/argument-of-type-headers-headers-is-not-assignable-to-parameter-of-type-requestoptionsargs-property-null-is-missing-in-type-headers-headers/102521>\
**Category:** ionic-v3\
**Created:** [August 19, 2017, 6:45am UTC](https://forum.ionicframework.com/t/argument-of-type-headers-headers-is-not-assignable-to-parameter-of-type-requestoptionsargs-property-null-is-missing-in-type-headers-headers/102521 "2017-08-19T06:45:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shivani8710](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/shivani8710/32/112070_2.png) [@shivani8710](https://forum.ionicframework.com/u/shivani8710)\
**Post date:** [August 19, 2017, 6:45am UTC](https://forum.ionicframework.com/t/argument-of-type-headers-headers-is-not-assignable-to-parameter-of-type-requestoptionsargs-property-null-is-missing-in-type-headers-headers/102521/1 "2017-08-19T06:45:02Z")

</div>

in ionic 2 …call web api using post method that time facing this error when I wrote { headers:headers }  
this is my code

error : Argument of type ‘{headers:Headers;}’ is not assignable to parameter of type ‘RequestOptionsArgs’.Property ‘null’ is missing in type ‘{headers:Headers;}’

```
var headers = new Headers();
    headers.append('Content-Type', 'application/x-www-form-urlencoded');
    //let options = new RequestOptions({ headers: headers });

    let postParams = {
        type: 'insertbranch',
        vendorid: 1,
        imgcode: ' ',
        address: 'varachhaSurat',
        latitude: '0',
        longitude: '0',
        branchmobile: '9853624221',
        gstno: '0'
    }

    this.http.post("MY URL", postParams, { headers: headers })
        .subscribe(data => {
            console.log(data['_body']);
        }, error => {
            console.log(error);// Error getting the data 
        });
```

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [August 19, 2017, 6:54am UTC](https://forum.ionicframework.com/t/argument-of-type-headers-headers-is-not-assignable-to-parameter-of-type-requestoptionsargs-property-null-is-missing-in-type-headers-headers/102521/2 "2017-08-19T06:54:56Z")

</div>

You don’t need custom headers here. Simply create the body as a [URLSearchParams](https://angular.io/api/http/URLSearchParams) and Angular will handle the rest.

---

<div class="post-metadata">

**Author:** ![rafaelmoura](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rafaelmoura/32/106057_2.png) [@rafaelmoura](https://forum.ionicframework.com/u/rafaelmoura)\
**Post date:** [December 25, 2017, 9:18pm UTC](https://forum.ionicframework.com/t/argument-of-type-headers-headers-is-not-assignable-to-parameter-of-type-requestoptionsargs-property-null-is-missing-in-type-headers-headers/102521/3 "2017-12-25T21:18:41Z")

</div>

the same problem here @shivani8710

---

<div class="post-metadata">

**Author:** ![birendrasharma98172](https://avatars.discourse-cdn.com/v4/letter/b/85e7bf/32.png) [@birendrasharma98172](https://forum.ionicframework.com/u/birendrasharma98172)\
**Post date:** [June 14, 2018, 8:58am UTC](https://forum.ionicframework.com/t/argument-of-type-headers-headers-is-not-assignable-to-parameter-of-type-requestoptionsargs-property-null-is-missing-in-type-headers-headers/102521/5 "2018-06-14T08:58:55Z")

</div>

Import this:  
import { Headers } from ‘@angular/http’;
