I'm using System.Net.Http.HTTPClient and in some sample code from a new Xmanarin project I've got a method that works fine. My question is: is this the generally accepted method of getting an object back to the caller?
public async Task<bool> AddItemAsync(Item item)
{
if (item == null || !IsConnected)
return false;
var serializedItem = JsonConvert.SerializeObject(item);
var response = await client.PostAsync($"api/item", new StringContent(serializedItem, Encoding.UTF8, "application/json"));
/// dig out the URI and fetch it back to be restful...
var json = await client.GetStringAsync(response.Headers.Location);
item= await Task.Run(() => JsonConvert.DeserializeObject<Item>(json));
return response.IsSuccessStatusCode;
}