i've seen how deserialize dictionary response, how send one?
var d = new dictionary<string, object> { { "foo", "bar" }, { "bar", 12345 }, { "jello", new { qux = "fuum", lorem = "ipsum" } } }; var r = new restrequest(url, method); r.addbody(d); // <-- how? var response = new restclient(baseurl).execute(r);
try this, it's example of simple post stuff you, prefer use restsharp in style because it's cleaner other variants of using it:
var mydict = new dictionary<string, object> { { "foo", "bar" }, { "bar", 12345 }, { "jello", new { qux = "fuum", lorem = "ipsum" } } }; var client = new restclient("domain name, example http://localhost:12345"); var request = new restrequest("part of url, example /home/index", method.post); request.requestformat = dataformat.json; request.addbody(new { dict = mydict }); // <-- possible answer client.execute(request); and example endpoint should have dict parameter in declaration.
Comments
Post a Comment