Click here to Skip to main content
15,921,548 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
ServerParams s1 = new ServerParams(serverParams);
           RestClient cl1 = new RestClient("http://1.2.3.4");
           cl1.AddHandler(contentType, new RestSharp.Deserializers.JsonDeserializer());
           RestRequest r1 = new RestRequest(RestSharp.Method.POST);
           r1.RequestFormat = DataFormat.Json;
           r1.AddHeader("X-Serenity-User", "admin");
           r1.AddHeader("X-Serenity-Password","admin");
           r1.Resource = resource;
           r1.AddHeader("Accept","application/vnd.resource+json");
           r1.AddHeader("Content-Type","application/vnd.resource+json");
           r1.AddObject(viewObject);
           IRestResponse response = cl1.Execute(r1);
           ValidateResponse(response);
           return response;
Posted
Updated 11-Nov-14 3:14am
Comments
Kornfeld Eliyahu Peter 11-Nov-14 9:18am    
That vnd.resource can be the problem! From where you got that?
DamithSL 11-Nov-14 9:39am    
try with
r1.AddHeader("Accept","application/json");
r1.AddHeader("Content-Type","application/json");

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900