Title: mtgox API Post by: grondilu on April 07, 2011, 10:06:53 PM MtGox API is weird. They say we should authenticate by sending or login and password via POST method, but they give an example where they are in URL: https://mtgox.com/code/getFunds.php?name=blah&pass=blah I don't get it. It data is in URL, isn't that GET method? Title: Re: mtgox API Post by: mndrix on April 07, 2011, 10:14:01 PM I'm guessing they show URL parameters as shorthand notation, since POST was specified elsewhere in the documentation.
Title: Re: mtgox API Post by: purplezky on April 07, 2011, 10:21:08 PM It should be a post.
I used to have a script mtgox.sh for that: curl -d `cat credentials` https://mtgox.com/code/${1}.php where the file credentials would contain: name=username&pass=password so you could do: mtgox.sh getFunds But lately, my script stopped working with: curl: (35) Unknown SSL protocol error in connection to mtgox.com:443 I tried looking into it, but it didn't seem to work, no matter if i change protocol version --sslv2 or use the --no-sessionid option, which people suggested when this error occurs. I guess mtgox SSL requirements changed somehow... Title: Re: mtgox API Post by: grondilu on April 07, 2011, 10:23:12 PM Indeed, I could connect with a command like: $ read -s passwd ; wget -q --no-check-certificate --no-proxy -O - "https://www.mtgox.com/code/getFunds.php" --post-data="name=grondilu&pass=$passwd" And I had my JSON string: {"usds":0,"btcs":0} This is pretty cool. Title: Re: mtgox API Post by: grondilu on April 07, 2011, 10:28:27 PM It should be a post. I used to have a script mtgox.sh for that: curl -d `cat credentials` https://mtgox.com/code/${1}.php where the file credentials would contain: name=username&pass=password so you could do: mtgox.sh getFunds But lately, my script stopped working with: curl: (35) Unknown SSL protocol error in connection to mtgox.com:443 I tried looking into it, but it didn't seem to work, no matter if i change protocol version --sslv2 or use the --no-sessionid option, which people suggested when this error occurs. I guess mtgox SSL requirements changed somehow... HAve you tried with www.mtgox.com instead of just mtgox.com? I think there is an issue about that. Title: Re: mtgox API Post by: purplezky on April 08, 2011, 09:48:41 AM www.mtgox.com gives the same error ???
Code: * About to connect() to www.mtgox.com port 443 (#0) Title: Re: mtgox API Post by: purplezky on April 08, 2011, 10:00:02 AM It seems like strace is saying the filehandle #3 which is the socket connecting to www.mtgox.com is temporarily unavailable... :-\
Code: socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3 Title: Re: mtgox API Post by: grondilu on April 08, 2011, 10:37:58 AM Well, if it doesn't work with curl, at least it does with wget. See above.
However, you might need to use a SSL-compiled version. See docs. Title: Re: mtgox API Post by: purplezky on April 08, 2011, 11:10:55 AM using wget gives the same SSL problem.
The strange thing is that connecting to the api worked fine last month. Now when i connect from a server in the USA or from Europe, they both give the same error. That's why i suspect that either curl and wget both got updated SSL libraries with an backwards incompatible SSL handshake (highly unlikely), or something changed in the implementation of the SSL handshake at mtgox.com (more plausible). Code: Setting --check-certificate (checkcertificate) to 0 Title: Re: mtgox API Post by: grondilu on April 08, 2011, 11:18:13 AM hum... it worked for me.
What versions of wget and libssl do you use? Mines are: libssl0.9.8: Installed: 0.9.8o-7 Candidate: 0.9.8o-7 Version table: *** 0.9.8o-7 0 500 http://ftp.fr.debian.org/debian/ sid/main i386 Packages 100 /var/lib/dpkg/status 0.9.8o-5 0 500 http://ftp.fr.debian.org/debian/ testing/main i386 Packages wget: Installed: 1.12-3 Candidate: 1.12-3 Version table: *** 1.12-3 0 500 http://ftp.fr.debian.org/debian/ sid/main i386 Packages 100 /var/lib/dpkg/status 1.12-2.1 0 500 http://ftp.fr.debian.org/debian/ testing/main i386 Packages Title: Re: mtgox API Post by: The Madhatter on April 08, 2011, 11:29:36 AM If it works with wget and not with curl that's because the CA mtgox used isn't in the certificate bundle that's included with curl. The CA bundle included with curl is notorious for being out of date.
If it doesn't work at all, my best guess is a misconfigured load balancer or poisoned DNS. Title: Re: mtgox API Post by: grondilu on April 08, 2011, 11:42:00 AM If it works with wget and not with curl that's because the CA mtgox used isn't in the certificate bundle that's included with curl. The CA bundle included with curl is notorious for being out of date. If it doesn't work at all, my best guess is a misconfigured load balancer or poisoned DNS. BTW, I haven't seen any equivalent of the "--no-check-certificate" option in curl's manual page. Title: Re: mtgox API Post by: The Madhatter on April 08, 2011, 11:53:55 AM BTW, I haven't seen any equivalent of the "--no-check-certificate" option in curl's manual page. "curl -k" Title: Re: mtgox API Post by: purplezky on April 08, 2011, 12:33:06 PM the gentoo packages with given USE flags, is what i used to produce the above errors
Code: [ebuild] dev-libs/openssl-1.0.0d USE="zlib -bindist -gmp -kerberos -rfc3779 -sse2 -test" I now tried to compile curl with gnutls to see if it makes a difference Code: [ebuild N ] dev-libs/libtasn1-2.9-r1 USE="-doc" Code: curl -v -k -d `cat credentials` https://www.mtgox.com/code/getFunds.php Title: Re: mtgox API Post by: purplezky on April 08, 2011, 12:49:38 PM ah i finally found out what was going wrong:
the server has disabled SSLv2, and if you don't specify to use SSLv3 with curl, it looks like it's doing a weird SSL handshake. Code: curl --sslv3 -d `cat credentials` https://www.mtgox.com/code/getFunds.php Thanks for all the advice. Title: Re: mtgox API Post by: MagicalTux on April 13, 2011, 05:46:13 AM Hi,
Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue) Mark Title: Re: mtgox API Post by: error on April 13, 2011, 06:29:24 PM Hi, Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue) This needs openssl 0.9.8j or later. On both ends. Title: Re: mtgox API Post by: MagicalTux on April 14, 2011, 05:25:38 AM Hi, Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue) This needs openssl 0.9.8j or later. On both ends. Running openssl 1.0.0d here~ Title: Re: mtgox API Post by: error on April 14, 2011, 05:47:21 AM Hi, Sorry for not seeing this thread sooner, I see there's a bug here (when ServerName matches the host name, TLS protocol doesn't work anymore), I fixed it for now by not providing a hostname in the vhost (and I'll try to upgrade openssl to see if it fixes the issue) This needs openssl 0.9.8j or later. On both ends. Running openssl 1.0.0d here~ Well the bug probably isn't in OpenSSL then. :) Title: Re: mtgox API Post by: grondilu on April 15, 2011, 01:49:52 AM If I want to do this more properly, i.e. using the MtGox certificate, anyone knows how I could do? I've seen on the web that I can retrieve the certificate with: openssl s_client -connect www.mtgox.com:443 -showcerts but I see several certificates (I think it's a chain or something). Any idea? Title: Re: mtgox API Post by: coga on June 17, 2011, 04:51:43 AM Is this still working? I am getting {"error":"not logged in"}
Title: Re: mtgox API Post by: grondilu on June 17, 2011, 11:55:18 AM Is this still working? I am getting {"error":"not logged in"} works fine here. curl --sslv3 -k -d "name=yourname&pass=yourpassword" https://mtgox.com/code/getFunds.php ; Title: Re: mtgox API Post by: sonba on July 04, 2011, 05:58:44 PM Hmmm... I'm also getting this "error:not logged in" message. Maybe someone can give me a hint what I'm doing wrong? And, sorry, yes - I actually did try it in VBA ;D makes it easier to do the bookkeeping for tax reasons as everything gets feeded into Excel.
Attached the part where I try to check my funds (obviously MyName and MyPass are my correct username and password :) Code: Set Req = New WinHttpRequest Hihgly appreciated if someone could help me here :) Thanks!!! Title: Re: mtgox API Post by: sonba on July 04, 2011, 07:25:43 PM Thanks, found the error - I was forgetting the header...
Req.SetRequestHeader "Content-Type", "application/x-www-form-urlencoded" Title: Re: mtgox API Post by: SmiGueL on August 26, 2012, 01:00:42 AM Since the change in march 2012 the API isn't accessible with username/password
but it seems to work with the API key. But whatever I'm trying to get this in VBA, this doesn't work for me.. :-\ When replacing the name & password with API key doesn't work, and the wiki (https://en.bitcoin.it/wiki/MtGox/API/HTTP) also isn't very helpful Code:
Can someone please help me with this? :) Rights at the MtGox website are checked, so that shouldn't be the problem.. Thanks in advance :) *Because I don't want to create a new topic with a question of an existing topic, I post it right here :) Title: Re: mtgox API Post by: SmiGueL on August 27, 2012, 04:43:23 PM Anyone?
I did a lot of googling and searching on the forum but couldn't find any working methods (all of them were made in 2011, and worked with name+pass login) Thanks in advance! :) |