XML : How to Post to RestSharp using XML - C#

I need to used this resource:

  request.Resource = "/spi-war/spi/{PartnerId}/{to}/{keyword}/messages/supported";    

And I need to post an XML request as follows:

  <message id="abcdef123">  <partnerpassword>111111</partnerpassword>  </message>    

I tried the addbody and some other things but it is not working. How can I accomplished this?

This is what I have so far:

    public virtual bool IsSupported(string to, string keyword, string partnerId)              {                  var messageId = Guid.NewGuid();                    var request = new RestRequest(Method.POST);                  request.RequestFormat = DataFormat.Xml;                  request.Resource = "/spi-war/spi/{partnerId}/{to}/{keyword}/messages/supported";            ow   // I  omitted the addbody because this is exactly what I dont know how to do it to make it work with more than one parameter.                   var response = Execute<Message>(request);                      return true;              }    

No comments:

Post a Comment