を使用して削除ウェブAPIメソッドを呼び出すときに、私は次のように構築する方法を削除し、私のウェブAPIを呼び出す必要があるシナリオを持っている本文の内容を渡す:System.Net.Http
// DELETE: api/products/{id}/headers
[HttpDelete("{id}/headers")]
public void DeleteProductHeaders(int id, [FromBody] string query)
{
}
トリックがでていることです上にクエリを取得するためには、私は本文を介してそれを送信する必要があり、DeleteAsyncにはjsonのようにparamはありません。誰も私がCでSystem.Net.Httpクライアントを使用してこれを行う方法を知っています#?
// Delete a product's headers
public void DeleteProductHeaders(int id, string query)
{
using (var client = GetClient())
{
HttpResponseMessage response;
try
{
// HTTP DELETE
response = client.DeleteAsync($"api/products/{id}/headers").Result;
}
catch (Exception ex)
{
throw new Exception("Unable to connect to the server", ex);
}
}
return retVal;
}
を達成する方法であります – Nkosi