Confusing at first I know. Look at what Emre says and what Paul did to get it to work …
function sendWebCli(){
var lib = host.lib("System");
var client = new lib.System.Net.WebClient();
// return client.DownloadString('https://www.goggle.com');
client.Headers.Add("Content Type", "application/json");
// client.Headers.Add(<more header stuff like maybe auth>);
var url = "https://api.blah.com/v1/access";
var data = 'some formatted data, like json';
var result = client.UploadString(url,data);
client.Dispose();
}
For example, when we do GQL Auth using jQuery AJAX, we set up authorization parameters in the header and data, like this:
jQuery.ajax({
'type': 'POST',
'url': aurl,
cache:false,
headers: {'Content-Type':'application/x-www-form-urlencoded'},
data: $.param({grant_type:'password', username:user, password:password, client_id:clientId, client_secret:clientSecret, device_id:deviceId})
})
.done(function d(response){
.........
})
.fail(function f(response){
.........
});