Bitcoin Forum

Economy => Service Discussion => Topic started by: newIndia on May 17, 2014, 09:51:11 AM



Title: BlockChain.info SendMany API - Need Help
Post by: newIndia on May 17, 2014, 09:51:11 AM
I am trying to send transaction to many people from a wallet using blockchain.info SendMany API. I am using the following URL for the same...

Code:
http://blockchain.info/merchant/$guid/sendmany?password=$firstpassword&recipients=$recipients&note=$note

Source: https://blockchain.info/api/api_send

As long as I'm not using &note=$note, but it stops working when I include this to have a public note attached. Anyone knows how to overcome this ? Do I need to use something else instead of 'note' as a param ? Any help in this regard is highly appreciated...


Title: Re: BlockChain.info SendMany API - Need Help
Post by: newIndia on May 18, 2014, 11:47:53 AM
Looks like the 'note' param has got the problem. None is using this feature ?

Code:
https://blockchain.info/merchant/$guid/payment?password=$main_password&second_password=$second_password&to=$address&amount=$amount&from=$from&shared=$shared&fee=$fee¬e=$note


Title: Re: BlockChain.info SendMany API - Need Help
Post by: Initscri on May 21, 2014, 08:20:18 PM
It might be an issue with a limit of the GET request.

Did an error come up to show the payment did not go through. Can you post the error here (obv don't if it contains secret information).


Title: Re: BlockChain.info SendMany API - Need Help
Post by: BitCoinDream on May 21, 2014, 09:44:57 PM
the problem is, I think, '&not' of &note represents an ASCII character and hence HTTP get is unable to take this param.


Title: Re: BlockChain.info SendMany API - Need Help
Post by: Initscri on May 21, 2014, 11:50:13 PM
the problem is, I think, '&not' of &note represents an ASCII character and hence HTTP get is unable to take this param.

Which then begs the question: Why is he using an API url within Html.

You should be sending the request to the BlockChain.info servers using a programming language such as PHP.
Example:

Code:
<?

$guid="GUID_HERE";
$firstpassword="PASSWORD_HERE";
$secondpassword="PASSWORD_HERE";
$amounta = "10000000";
$amountb = "400000";
$addressa = "1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq";
$addressb = "1ExD2je6UNxL5oSu6iPUhn9Ta7UrN8bjBy";
$recipients = urlencode('{
                  "'.$addressa.'": '.$amounta.',
                  "'.$addressb.'": '.$amountb.'
               }');

$json_url = "http://blockchain.info/merchant/$guid/sendmany?password=$firstpassword&second_password=$secondpassword&recipients=$recipients";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$message = $json_feed->message;
$txid = $json_feed->tx_hash;

?>


Title: Re: BlockChain.info SendMany API - Need Help
Post by: BitCoinDream on May 22, 2014, 10:51:06 AM
the problem is, I think, '&not' of &note represents an ASCII character and hence HTTP get is unable to take this param.

Which then begs the question: Why is he using an API url within Html.

You should be sending the request to the BlockChain.info servers using a programming language such as PHP.
Example:

Code:
<?

$guid="GUID_HERE";
$firstpassword="PASSWORD_HERE";
$secondpassword="PASSWORD_HERE";
$amounta = "10000000";
$amountb = "400000";
$addressa = "1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq";
$addressb = "1ExD2je6UNxL5oSu6iPUhn9Ta7UrN8bjBy";
$recipients = urlencode('{
                  "'.$addressa.'": '.$amounta.',
                  "'.$addressb.'": '.$amountb.'
               }');

$json_url = "http://blockchain.info/merchant/$guid/sendmany?password=$firstpassword&second_password=$secondpassword&recipients=$recipients";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$message = $json_feed->message;
$txid = $json_feed->tx_hash;

?>

The one u have mentioned from the blockchain.info send API does not have the 'note' param. If include the 'note' param in the json_url, it'll eventually throw an error at file_get_contents, where the jso_url is parsed.


Title: Re: BlockChain.info SendMany API - Need Help
Post by: Initscri on May 22, 2014, 11:05:26 PM
The one u have mentioned from the blockchain.info send API does not have the 'note' param. If include the 'note' param in the json_url, it'll eventually throw an error at file_get_contents, where the jso_url is parsed.

I was, more or less, just posting a template for use.
What error would it return. I don't see a reason as to why it would return an error provided he uses

Code:
urlencode($note);

before providing the note.

Therefore:
This is just a test note
would turn into:
This%20is%20a%20test%20note

and would be accepted by BlockChain.info.

As an example: The code should be along the lines of:

Code:
<?
$note = urlencode("NOTE HERE");
$guid="GUID_HERE";
$firstpassword="PASSWORD_HERE";
$secondpassword="PASSWORD_HERE";
$amounta = "10000000";
$amountb = "400000";
$addressa = "1A8JiWcwvpY7tAopUkSnGuEYHmzGYfZPiq";
$addressb = "1ExD2je6UNxL5oSu6iPUhn9Ta7UrN8bjBy";
$recipients = urlencode('{
                  "'.$addressa.'": '.$amounta.',
                  "'.$addressb.'": '.$amountb.'
               }');

$json_url = "http://blockchain.info/merchant/$guid/sendmany?password=$firstpassword&second_password=$secondpassword&recipients=$recipients&note=$note";

$json_data = file_get_contents($json_url);

$json_feed = json_decode($json_data);

$message = $json_feed->message;
$txid = $json_feed->tx_hash;

?>