This change cleans up the `API-CHANGELOG.md` file. It moves the version-specific documentation to other files and fleshes out the changelog with all the API-related changes in each version.
6.1 KiB
API Version 2
API version 2 is available in rippled version 2.0.0 and later. To use this API, clients specify "api_version" : 2 in each request.
For info about how API versioning works, including examples, please view the XLS-22d spec. For details about the implementation of API versioning, view the implementation PR. API versioning ensures existing integrations and users continue to receive existing behavior, while those that request a higher API version will experience new behavior.
Removed methods
In API version 2, the following deprecated methods are no longer available: (#4759)
tx_history- Instead, use other methods such asaccount_txorledgerwith thetransactionsfield set totrue.ledger_header- Instead, use theledgermethod.
Modifications to JSON transaction element in API version 2
In API version 2, JSON elements for transaction output have been changed and made consistent for all methods which output transactions. (#4775) This helps to unify the JSON serialization format of transactions. (clio#722, #4727)
- JSON transaction element is named
tx_json - Binary transaction element is named
tx_blob - JSON transaction metadata element is named
meta - Binary transaction metadata element is named
meta_blob
Additionally, these elements are now consistently available next to tx_json (i.e. sibling elements), where possible:
hash- Transaction ID. This data was stored inside transaction output in API version 1, but in API version 2 is a sibling element.ledger_index- Ledger index (only set on validated ledgers)ledger_hash- Ledger hash (only set on closed or validated ledgers)close_time_iso- Ledger close time expressed in ISO 8601 time format (only set on validated ledgers)validated- Bool element set totrueif the transaction is in a validated ledger, otherwisefalse
This change affects the following methods:
tx- Transaction data moved into elementtx_json(was inline insideresult) or, if binary output was requested, moved fromtxtotx_blob. Renamed binary transaction metadata element (if it was requested) frommetatometa_blob. Changed location ofhashand added new elementsaccount_tx- Renamed transaction element fromtxtotx_json. Renamed binary transaction metadata element (if it was requested) frommetatometa_blob. Changed location ofhashand added new elementstransaction_entry- Renamed transaction metadata element frommetadatatometa. Changed location ofhashand added new elementssubscribe- Renamed transaction element fromtransactiontotx_json. Changed location ofhashand added new elementssign,sign_for,submitandsubmit_multisigned- Changed location ofhashelement.
Modifications to Payment transaction JSON schema
When reading Payments, the Amount field should generally not be used. Instead, use delivered_amount to see the amount that the Payment delivered. To clarify its meaning, the Amount field is being renamed to DeliverMax. (#4733)
- In
Paymenttransaction type, JSON RPC fieldAmountis renamed toDeliverMax. To enable smooth client transition,Amountis still handled, as described below: (#4733)- On JSON RPC input (e.g.
submit_multisignedetc. methods),Amountis recognized as an alias toDeliverMaxfor both API version 1 and version 2 clients. - On JSON RPC input, submitting both
AmountandDeliverMaxfields is allowed only if they are identical; otherwise such input is rejected withrpcINVALID_PARAMSerror. - On JSON RPC output (e.g.
subscribe,account_txetc. methods),DeliverMaxis present in both API version 1 and version 2. - On JSON RPC output,
Amountis only present in API version 1 and not in version 2.
- On JSON RPC input (e.g.
Modifications to account_info response
signer_listsis returned in the root of the response. (In API version 1, it was nested underaccount_data.) (#3770)- When using an invalid
signer_listsvalue, the API now returns an "invalidParams" error. (#4585)- (
signer_listsmust be a boolean. In API version 1, strings were accepted and may return a normal response - i.e. as ifsigner_listsweretrue.)
- (
Modifications to account_tx response
- Using
ledger_index_min,ledger_index_max, andledger_indexreturnsinvalidParamsbecause if you useledger_index_minorledger_index_max, then it does not make sense to also specifyledger_index. In API version 1, no error was returned. (#4571)- The same applies for
ledger_index_min,ledger_index_max, andledger_hash. (#4545)
- The same applies for
- Using a
ledger_index_minorledger_index_maxbeyond the range of ledgers that the server has:- returns
lgrIdxMalformedin API version 2. Previously, in API version 1, no error was returned. (#4288)
- returns
- Attempting to use a non-boolean value (such as a string) for the
binaryorforwardparameters returnsinvalidParams(rpcINVALID_PARAMS). Previously, in API version 1, no error was returned. (#4620)
Modifications to noripple_check response
- Attempting to use a non-boolean value (such as a string) for the
transactionsparameter returnsinvalidParams(rpcINVALID_PARAMS). Previously, in API version 1, no error was returned. (#4620)