Below is the method, where I have an HttpClient method defined with Post method, the webservice url is called from a constructor. I would like to pass a query parameter in the URL along with body, I have the body defined here but not sure the best way to pass the query parameter. If I have web service url as :
http://localhost:7071/api/Function1
I would like my overwrite argument to be passed as a parameter like this:
http://localhost:7071/api/Function1?read = True/false(value of overwrite)
Code:
private async Task UpsertInt<T>(T rec, bool overwrite) where T : Document
{
HttpClient client = new HttpClient();
var ser = new JsonSerializer { NullValueHandling = NullValueHandling.Ignore };
var wr = new StringWriter();
ser.Serialize(wr, rec);
await client.PostAsJsonAsync(WebService, wr.ToString());
}