Difference between revisions of "Elis-API"

From Bitcoin Wiki
Jump to: navigation, search
(Created page with "Bitcoin API call list (as of version 0.3.20.2) with code samples and returned values. == API Calls == API Calls to JSON-RPC are sent using POST method and parameters are sen...")
 
Line 18: Line 18:
  
 
<strong><tt>params</tt></strong> is the <strong><tt>Array</tt></strong> parameters that you're sending with the method invocation. Note that these parameters are sent as an <tt>Array</tt> notation and not <tt>Object</tt> notation.
 
<strong><tt>params</tt></strong> is the <strong><tt>Array</tt></strong> parameters that you're sending with the method invocation. Note that these parameters are sent as an <tt>Array</tt> notation and not <tt>Object</tt> notation.
 +
 +
<strong><tt>id</tt></strong> is used by the app requesting, and I usually just send the method name as the ID
 +
 +
== Calls List ==
 +
 +
Required arguments are denoted inside < and > Optional arguments are inside [ and ].
  
 
=== backupwallet ===
 
=== backupwallet ===
 +
 +
Safely copies wallet.dat to destination, which can be a directory or a path with filename.
 +
 +
==== Arguments ====
 +
 +
<tt>0</tt> <strong>Destination</strong> The destination of the wallet file it will be copied to. This needs to be a valid <tt>directory</tt> in your file system passed in linux style (forward slashes (<tt>/</tt>) as separators - linux style, not backward slashes (<tt>\</tt>) - windows style). The directory <strong>must not have a file named <tt>wallet.dat</tt></strong> otherwise the operation will fail.
 +
 +
==== Example Request ====
 +
 +
<syntaxhighlight lang="javascript">{"method":"backupwallet","params":["d:/wallet/"],"id":"backupwallet"}:</syntaxhighlight>
 +
 +
==== Result ====

Revision as of 09:46, 11 September 2011

Bitcoin API call list (as of version 0.3.20.2) with code samples and returned values.

API Calls

API Calls to JSON-RPC are sent using POST method and parameters are sent as JSON object.

Example Request

When requesting something from the JSON-RPC server the request is sent to the server with the following URL: http://user:pass@localhost:8332/ with post data that looks something like this:

{"method":"listreceivedbyaccount","params":[0],"id":"listreceivedbyaccount"}:

The Bitcoind server user JSON notation instead of using regular POST parameters which can cause confusions sometime. Note the trailing colon on the post data above.

The JSON object that is being sent to the server is composed of 3 elements: method, params, and id.

method is what method you want to invoke, this is a simple string representing the method you're invoking.

params is the Array parameters that you're sending with the method invocation. Note that these parameters are sent as an Array notation and not Object notation.

id is used by the app requesting, and I usually just send the method name as the ID

Calls List

Required arguments are denoted inside < and > Optional arguments are inside [ and ].

backupwallet

Safely copies wallet.dat to destination, which can be a directory or a path with filename.

Arguments

0 Destination The destination of the wallet file it will be copied to. This needs to be a valid directory in your file system passed in linux style (forward slashes (/) as separators - linux style, not backward slashes (\) - windows style). The directory must not have a file named wallet.dat otherwise the operation will fail.

Example Request

{"method":"backupwallet","params":["d:/wallet/"],"id":"backupwallet"}:

Result