Can I have a webapi method
[Route("someroute")]
public void SomeMethod(string variable1, int variable2, Guid variable3)
{
//... Code here
}
simple json
var jsonvariable = new {
variable1:"somestring",
variable2:3,
variable3: {9E57402D-8EF8-45DE-B981-B8EC201D3D8E}
}
Then make the post
HttpClient client = new HttpClient { BaseAddress = new Uri(ConfigurationManager.AppSettings["SomeURL"]) };
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
client.PostAsJsonAsync("someroute", jsonvariable ).Result
Coming from javascript I can do something like this and it resolves the individual properties but I can't seem to do it with a C# call
var postData = {
appUniqueId: appUniqueId
};
$http
.post('someurl', postData)
.success(function(response) {
defer.resolve(response.data);
});
webapi method
SomeWebMethod(Guid appUniqueId) <-- same name as in postdata