title: How to use Body parameter In an API Post request using Typescript
body: <p>I wanted to know how to add a body to an api request using typescript. Ive done this request on postman and i got the response, however i dont know how to do it using typescript. I keep getting a "BAD REQUEST". I check the api documentation from the host and they showed me how to do it:</p>
  
  <pre><code>Request Format
  POST https://api.channeladvisor.com/oauth2/token
  
  Authorization: Basic [application id:shared secret]
  Content-Type: application/x-www-form-urlencoded
  Body: grant_type = refresh_token &amp;
        refresh_token = [refresh token]
  </code></pre>
  
  <p>I have the refresh token and the authorization details with me. So i tried doing this in typescript:</p>
  
  <pre><code>this.http.post('https://api.channeladvisor.com/oauth2/token',                    
    {body:{
      grant_type:"refresh_token",
      refresh_token:this.refresh_token
    }},
  
    {headers:{
      'Authorization':this.token
      }})
  .subscribe((response)=&gt;{
      this.new_token=response;
      console.log("This is the new token")
        console.log(this.new_token)
    })
  }
  </code></pre>
  
  <p>But when i run it i get a bad request error. I assume it has something do with with the syntax.</p>