Bitcoin Forum

Other => Beginners & Help => Topic started by: withers on April 17, 2013, 07:07:24 PM



Title: Please help using Bitstamp APIs
Post by: withers on April 17, 2013, 07:07:24 PM
Hello,

Can someoone please help me get my account balance using the bitstamp api.

The apis are listed here https://www.bitstamp.net/api/

The account balance api is at this address https://www.bitstamp.net/api/balance/

But what is the url supposed to be? I think I can test the url in firefox.

So for example, in firefox i type https://www.bitstamp.net/api/ticker/ and it returns the correct results.

What is the address for my account balance? I've tried

https://www.bitstamp.net/api/balance/myUsername/myPassword

and

https://www.bitstamp.net/api/balance/?user=myUsername/?password=myPassword

but neither urls work.

Can anybody please shed some light? Many thanks in advance


Title: Re: Please help using Bitstamp APIs
Post by: wilfried on April 19, 2013, 10:09:04 PM
hy
bitstamp uses post, not get. you cant put post requests in ulr-field of a browser. either use a form or a script
url would be

https://www.bitstamp.net/api/balance?user:xxxx&password:xxxx


Title: Re: Please help using Bitstamp APIs
Post by: minzie on April 25, 2013, 10:56:36 PM
I was almost very happy... I have been trying a boilerplate jQuery ajax function that always works, and it is failing:
Code:
$.ajax ({
 type: "POST",
url: "https://www.bitstamp.net/api/balance/",
                                        data: { user:"999", password:"venomous_rat_regeneration" }
}).success( function(msg)
{
alert(msg);
}).error ( function( msg, e )
{
 var message;

for (property in msg) {
                                                           message += property + ":" + msg[property] + "\n";
                                                        }
 alert(message);
});

I also tried:
Code:
             $.post("https://www.bitstamp.net/api/balance", { user: "999", password: "venomous_rat_regeneration" })
             .done(function(msg) {
                     //alert("Data Loaded: " + data);
   var message;

   for (property in msg) {
                        message += property + ":" + msg[property] + "\n";
                     }

    alert(message);
             });

I expect to get a json object back that I can traverse like a normal javascript object, but I am getting an error object instead.


Title: Re: Please help using Bitstamp APIs
Post by: milo on April 25, 2013, 11:02:58 PM
You can manually plink around with REST APIs in the Chrome browser using the Dev HTTP Client plugin for Chrome.  Highly recommended, great tool.  Get, Put, Post, content types, even automates creation of basic auth tokens.


Title: Re: Please help using Bitstamp APIs
Post by: minzie on April 26, 2013, 10:35:53 AM
I don't understand how that solves anything.


Title: Re: Please help using Bitstamp APIs
Post by: bitcoin-index on April 26, 2013, 12:16:32 PM
I wish I could figure out APIs.  They seem like they would be a lot of fun.


Title: Re: Please help using Bitstamp APIs
Post by: minzie on April 26, 2013, 06:31:44 PM
I can't get it to work using curl either, which is how I am retrieving the ticker. Weird.


Title: Re: Please help using Bitstamp APIs
Post by: minzie on April 27, 2013, 12:49:20 PM
Sorry for the double post, and I realize I am probably helping nobody, but I figured out my issue, and I didn't want to leave this thread incomplete. I did not have my account set to allow API access.  :-\