title: Using POST for Wego flights API
body: <p>I have been trying to implement the Wego flights API from <a href="http://support.wan.travel/hc/en-us/articles/200191669" rel="nofollow">http://support.wan.travel/hc/en-us/articles/200191669</a> which uses HTTP POST requests. I've only really ever used GET requests, so I did some reading on POST and so far I have not been able to find a way to post a request.</p>
  
  <pre><code>POST api.wego.com/flights/api/k/2/searches
  
  {
  "trips": [
  {
    "departure_code": "SYD",
    "arrival_code": "LON",
    "outbound_date": "2014-01-24",
    "inbound_date": "2014-01-29"
  }
  ],
  "adults_count": 1
  }  
  </code></pre>
  
  <p>It requires <code>POST api.wego.com/flights/api/k/2/searches?api_key=your_secret_api_key&amp;ts_code=your_s‌​ecret_ts_code</code>. What's wrong with this code?</p>
  
  <pre><code> var http = new XMLHttpRequest();
  var url = "http://api.wego.com/flights/api/k/2/searches?key=xxxxxxxxxxxxx&amp;ts_code=xxxxx"";
      var params = {
         "trips": [
            {
               "departure_code": "SYD",
               "arrival_code": "LON",
               "outbound_date": "2014-01-24",
               "inbound_date": "2014-01-29"
            }
         ],
         "adults_count": 1
      };
  http.open("POST", url);
  
  //Send the proper header information along with the request
  http.setRequestHeader("Content-type", "application/json");
  http.setRequestHeader("Accept", "application/json");
  
  
  http.onreadystatechange = function() {//Call a function when the state changes.
  if(http.readyState == 4 &amp;&amp; http.status == 200) {
      alert(http.responseText);
  }
  }
  var json = JSON.stringify(params);
  http.send(json);
  </code></pre>
  
  <p>I'm getting <code>Invalid HTTP status code 403</code></p>