Elis-API

From Bitcoin Wiki
Revision as of 09:46, 11 September 2011 by Eli (talk | contribs)
Jump to navigation Jump to search

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