|
Title: cryptsy api unknown method error Post by: nubas on July 06, 2013, 07:40:35 PM DateTime dt = DateTime.Now;
int tick = dt.Year + dt.Month + dt.Day + dt.Hour + dt.Minute + dt.Second + dt.Millisecond; string par = "method=getinfo&nonce=" + tick.ToString(); byte[] parBytes = encoding.GetBytes(par); var keyByte = encoding.GetBytes(privKey + par); var hmac = new HMACSHA512(keyByte); string finalPass = BitConverter.ToString(hmac.Key, 0).Replace("-", ""); string url = "https://www.cryptsy.com/api.php"; var webRequest = (HttpWebRequest)WebRequest.Create(url); webRequest.Credentials = new NetworkCredential(pubKey, finalPass); if (webRequest != null) { webRequest.Method = "POST"; Stream newStream = webRequest.GetRequestStream(); // Send the data. newStream.Write(parBytes, 0, parBytes.Length); newStream.Close(); var httpResponse = (HttpWebResponse)webRequest.GetResponse(); using (var streamReader = new StreamReader(httpResponse.GetResponseStream())) { var result = streamReader.ReadToEnd(); } why i always get in result: {"success":0,"error":"unknown method"} Title: Re: cryptsy api unknown method error Post by: scintill on July 07, 2013, 02:54:45 AM Since nobody else has answered yet, here's a guess: maybe you need to set the POST body content-type. If this is C#/.NET, try setting the HttpWebRequest object's ContentType and maybe also ContentLength as shown in the example code here (http://msdn.microsoft.com/en-us/library/d4cek6cc.aspx).
Title: Re: cryptsy api unknown method error Post by: monsterer on July 07, 2013, 11:11:43 AM Does this shed any light:
Code: [b]Authenticated Methods [/b] ? Title: Re: cryptsy api unknown method error Post by: MarpleTrading on August 31, 2013, 11:07:35 AM Have you solved this problem, very interested in how.
Also sent you a PM. Title: Re: cryptsy api unknown method error Post by: abwaters on December 28, 2013, 02:22:14 AM You need to send the arguments "method" and "nonce" as post arguments. You will also want to set Content-Type as application/x-www-form-urlencoded and set the HTTP headers Key and Sign.
Take a look at the Crypsty.java method authrequest() in the following github repository for a java example. If you rework your code i'll be glad to help you debug it. https://github.com/abwaters/cryptsy-api -bryanw |