Author

Topic: cryptsy api unknown method error (Read 2461 times)

newbie
Activity: 9
Merit: 0
December 27, 2013, 09:22:14 PM
#5
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
full member
Activity: 191
Merit: 100
August 31, 2013, 06:07:35 AM
#4
Have you solved this problem, very interested in how.

Also sent you a PM.
legendary
Activity: 1008
Merit: 1007
July 07, 2013, 06:11:43 AM
#3
Does this shed any light:

Code:
[b]Authenticated Methods [/b]
Authenticated methods require the use of an api key and can only be accessed via the POST method.

URL - The URL you will be posting to is: https://www.cryptsy.com/api (notice it does NOT have the '.php' at the end)

?
sr. member
Activity: 448
Merit: 254
July 06, 2013, 09:54:45 PM
#2
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.
newbie
Activity: 28
Merit: 0
July 06, 2013, 02:40:35 PM
#1
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"}
Jump to: