Saturday 15 August 2015

rest - Send POST request with the same name of parameters in C# -



rest - Send POST request with the same name of parameters in C# -

i want send post request many parameters same name:

formurlencodedcontent content = new formurlencodedcontent(new [] { new keyvaluepair < string, string > ("group_id", "344"), new keyvaluepair < string, string > ("group_id", "20"), new keyvaluepair < string, string > ("group_id", "456") }); httpresponsemessage response = await _httpclient.postasync("http://localhost/api", content);

but if utilize above request response first group_id (with 344 id). have thought how can obtain "group_id[]=344&group_id[]=20&group_id[]=456" using formurlencodedcontent ?

you using multiple key-value pairs same keys. that's never allowed. these key-value pairs ignored: new keyvaluepair<string, string>("group_id", "20"), new keyvaluepair<string, string>("group_id", "456")

the api expects kind of input must alter design.

c# rest http-post

No comments:

Post a Comment