2016-07-26 4 views
1

cは私が私がdata_jsonをどのように使うのですか、これは私が今、これまで使用してRESTサービスの受け渡しJSONは#

HttpClient client = CreateClient(this.url, this.username, this.password); 
string data_json = Newtonsoft.Json.JsonConvert.SerializeObject(Detail, Newtonsoft.Json.Formatting.Indented); 
//Detail is a class with the json data 
HttpResponseMessage response = client.GetAsync(uri).Result; 
result = response.Content.ReadAsStringAsync().Result; 

持っているものであるJSON

返すRESTサービスを呼んでいますか?私は応答を得るためにjsonを渡す必要があります。

+0

パス? – Steve

答えて

1

あなたはあなたのポストの要求に含める必要があります。そのポスト体内の

StringContent stringContent = new StringContent(data_json, UnicodeEncoding.UTF8, "application/json"); 
var result = client.PostAsync(uri, stringContent).Result; 
関連する問題