Difference between revisions of "API Reference"

From Bitmessage Wiki
Jump to navigation Jump to search
(Created page with "=== Enable the API === To enable the API, copy and paste these lines into the bitmessagesettings section of the keys.dat file: <pre> apienabled = true apiport = 8442 apiinterf...")
 
Line 34: Line 34:
 
* encodingtype
 
* encodingtype
 
* receivedtime
 
* receivedtime
 +
 +
The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin). The encodingtype property is currently always set to 2 because, unfortunately, the inbox table in Bitmessage does not record the encoding type. In the future it record the encoding type and this field will be accurate therefore field is included here to maintain forwards compatibility.

Revision as of 22:07, 18 March 2013

Enable the API

To enable the API, copy and paste these lines into the bitmessagesettings section of the keys.dat file:

apienabled = true
apiport = 8442
apiinterface = 127.0.0.1
apiusername = bradley
apipassword = yourSuperWonderfulPassword98a8#5223345

List of Operations

Required arguments are denoted inside < and >

Command Parameters Description
listAddresses Lists all addresses shown on the Your Identities tab. Returns a list of objects with these properties:
  • label
  • address
  • stream
  • enabled
createRandomAddress <eighteenByteRipe> <label> Creates one address using the random number generator. Supply a boolean telling Bitmessage whether to generate an address with an 18 byte ripe (as opposed to a 19 byte ripe). This is the same setting as the "Do extra work to make the address 1 or 2 characters shorter" in the user interface. Using False is recommended if you are running some sort of website and will be generating a lot of addresses.

Returns the address.

createDeterministicAddresses <passphrase> <addressVersionNumber> <streamNumber> <numberOfAddresses> <eighteenByteRipe> Similar to the createRandomAddress except that you may generate many addresses in one go. Returns a list of new addresses.
getAllInboxMessages Does not include the messages in the trash. Returns a list of objects with these properties:
  • msgid
  • toaddress
  • fromaddress
  • subject
  • message
  • encodingtype
  • receivedtime

The msgid is the same as the hash of the message (analogous to the TXID in Bitcoin). The encodingtype property is currently always set to 2 because, unfortunately, the inbox table in Bitmessage does not record the encoding type. In the future it record the encoding type and this field will be accurate therefore field is included here to maintain forwards compatibility.