0
私は実際に自動取引を行うためのAPI情報を取得しています。ここで コードです:そのコードのため JSON POSTリクエストの一部を無視する方法
{"success":{"orderId":"6d8bcd05-57c5-4b8d-a4b5-c7080f3c84fd","pair":"eth_xmr","withdrawal":"***SNIP***","withdrawalAmount":"1.08518719","deposit":"0x93163985f6b4d4687ac7bc63d54016ed2d5f6aec","depositAmount":"0.34529822","expiration":1507244337386,"quotedRate":"3.20067447","maxLimit":16.79846053,"apiPubKey":"shapeshift","minerFee":"0.02"}}
これが表示され
、他のクラスは、変数にそれらを置くために、それらの情報を取得している(感謝クリストス:実行後string webAddr = "https://shapeshift.io/sendamount";
var httpWebRequest = (HttpWebRequest)WebRequest.Create(webAddr);
httpWebRequest.ContentType = "application/json; charset=utf-8";
httpWebRequest.Method = "POST";
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{ \"amount\" : \"1.08518719\", \"withdrawal\" : \"***SNIP***\", \"pair\" : \"eth_xmr\" }";
streamWriter.Write(json);
streamWriter.Flush();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var responseText = streamReader.ReadToEnd();
var apiResponse = JsonConvert.DeserializeObject<ApiResponse>(responseText);
Console.WriteLine(responseText);
、それは私にこれを与えています)
public class ApiResponse
{
[JsonProperty("orderId")]
public static string orderId { get; set; }
[JsonProperty("pair")]
public static string pair { get; set; }
[JsonProperty("withdrawal")]
public static string withdrawal { get; set; }
[JsonProperty("withdrawalAmount")]
public static string withdrawalAmount { get; set; }
[JsonProperty("deposit")]
public static string deposit { get; set; }
[JsonProperty("depositAmount")]
public static string depositAmount { get; set; }
[JsonProperty("expiration")]
public static string expiration { get; set; }
[JsonProperty("quotedRate")]
public static string quotedRate { get; set; }
[JsonProperty("maxLimit")]
public static string maxLimit { get; set; }
[JsonProperty("apiPubKey")]
public static string apiPubKey { get; set; }
[JsonProperty("minerFee")]
public static string minerFee { get; set; }
}
問題は機能しないということです。私はそれが応答の初めから(それが完全に働いているAPIからの他のオプションで) "成功"から来ていると思うし、他の情報だけを得るためにそれを "迂回する"方法を知らない。