Quantcast
Channel: WCF, ASMX and other Web Services
Viewing all articles
Browse latest Browse all 555

how to format the response message of web api post method

$
0
0

Dear all,

How can I format the response message of web api post method?

public async System.Threading.Tasks.Task<EmpResponse> SendEmpDetails(EmpRequest request)
{


double Code = request.Code;


client.BaseAddress = new Uri("http://");
client.DefaultRequestHeaders.Accept.Clear();
client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
EmpResponse res = new EmpResponse();


HttpResponseMessage response = await client.PostAsJsonAsync("api/SendEMP", request).ConfigureAwait(false);
response.EnsureSuccessStatusCode();
return res;
}

I am getting the following response,.

"Result":
{
"resMsg": "OK"
},

"Id": 66,

"Exception": null,

"Status": 5,

"IsCanceled": false,

"IsCompleted": true,

"CreationOptions": 0,

"AsyncState": null,

"IsFaulted": false

but what i want is just

{
"resMsg": "OK"
}

can anyone please help me?

thanks

nick


Viewing all articles
Browse latest Browse all 555

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>