I am trying to send a POST request to a web services that uses and API. The service only allows POST requests so I tried:
var xhr = Ti.Network.createHTTPClient(); xhr.open('POST', 'http://www.example.com/api?foobar=true');
… but it is sending back an error stating that the request wasn't a post request. Is there something I am doing wrong or should I be looking to use a separate function?
That code looks like (assuming you have a send after the xhr.open). We have a number of tests around POST requests so we're pretty sure it works fine. If you could provide more detail.
You have written
It should be
'POST' should be replaced as "POST"
Rest every thing is fine.