Closed tim-peterson closed 10 years ago
Hey Tim, here's what I see:
$ curl https://block.io/api/v1/get_balance/?api_key=YOURDOGEAPIKEY { "status": "success", "data": { "network": "DOGE", "available_balance": "XYZAMOUNT.DECIMALS", "unconfirmed_sent_balance": "0.00000000", "unconfirmed_received_balance": "0.00000000" } }
$ curl https://block.io/api/v1/get_balance/?api_key=YOURDOGEAPIKEY\&user_id=0 { "status": "success", "data": { "network": "DOGE", "available_balance": "0.00000000", "unconfirmed_sent_balance": "0.00000000", "unconfirmed_received_balance": "0.00000000", "user_id": 0, "address": "DR......", "label": "default" } }
Seems to be working as intended. Do you have an example URL you can give us to replicate this?
The issue is with the PHP library. The PHP methods are called get_balance
and get_user_balance
, but neither will recognize when I plug in a user_id
.
For example, this gives the balance for the total account and not user 7
:
$data['balance'] = $doge->get_balance(array("user_id" => 7));
Tim, I see how you're using it. It was originally intended to simply get the balance for the entire account, and get_user_balance was supposed to be for specifics.
I've changed the library to allow get_balance to accept/pass arguments. I've updated Composer, as well as version numbers on the API docs. New version: 0.2.1. Thanks :)
By the way, get_user_balance should accept user_id as is. Can you update this after you try with the new library?
Here's what I'm doing:
print $block_io->get_user_balance(array('user_id' => 38))->data->available_balance;
Sorry for the delay. Just updated to 0.2.1 and now both get_balance
and get_user_balance
work with arguments, e.g.,
$blockio->get_user_balance(array("label" => "my_user_label"));
Thanks again!
get_user_balance
doesn't properly acceptuser_id
as a param. It shows the same balance as the total account, i.e.,get_balance
.