Search code examples
c#responserestsharpxml-deserialization

Get Response Data in XML format in IRestResponse response = client.Execute(request);


I am using restsharp client to execute the restful API. I want to get response data in XML format while executing the restful API.

IRestResponse response = client.Execute(request);

API returns the 'XML' format. Many thanks in advance for any help you can provide.


Solution

  • I found the solution. Need to add the header parameter in the request. Please see the below code.

    request.AddHeader("Accept", "text/xml");