Rippled API Overview

From Ripple Wiki
Jump to: navigation, search

Contents

JSON Messaging

Business servers interact with the Ripple network by sending JSON formatted messages to their local rippled server. In reply rippled sends back JSON formatted responses.

There are two broad categories of JSON messages.

  1. Queries which return information about the current state of the server or the ledger.
  2. Transactions which change the state of the server or ledger.

All JSON messages are documented on this wiki page: JSON Messages

JSON data formatting rules are specified here: JSON format

The current state of every account, trust line and market offer is represented in the Ripple ledger. The ledger format is documented here: Ledger Format

Transaction types and formats are listed here: Transactions

Websockets vs RPC

Messages can be passed either by making individual RPC calls to the rippled server, or by opening a persistent websocket connection and submitting JSON requests over that channel. The individual JSON requests and responses use the same data format no matter which communication channel you chose to use.

The choice of communication channel is up to the integrator. The choice often depends on the language the existing business server is written in and the skills of the development team. Websockets is a more modern interface and is more suitable to high volume businesses. It is also allows user interfaces to update dynamically. RPC’s synchronous nature makes it easy for quick experimentation. https://ripple.com/wiki/Websocket_API#Websocket_vs_RPC

Higher level interfaces

command line

The rippled executable also provides a command line interface that simplifies sending RPC requests to your server. Command Line Agent

ripple-lib

Ripple Labs provides a javascript library called ripple-lib which abstracts the low level message sending details. This library is helpful for browser based user interfaces that interact with Ripple. It is also useful to those writing their business server in node.js.

If you are developing in a language other than javascript, ripple-lib can serve as a helpful reference implementation on which to base your implementation. https://github.com/ripple/ripple-lib

API's for Integration

We recommend that most new integratiors write to the REST api. However, the other APIs continue to be supported.

rippled Command Line
This is the easiest way to submit manual commands to rippled. It requires building rippled locally. The CLI submits RPC commands to the rippled server configured in rippled.cfg.
JSON RPC
This is useful for its ease in submitting simple CURL commands. Connections are HTTP request/response style.
Web Sockets
This provides a continuous connection between your integration's server and rippled. It also simplifies subscribing to ledger notifications.
ripple-lib
This library is useful for those writing in javascript. Either in the browser or server side using node.js. It submits commands over rippled's web socket interface.
Ripple-REST
This is a separate server written in node.js. It flattens and minimizes the number of JSON message formats in order to make it easier to integrate from statically compiled (class based) languages. Ripple-REST uses ripple-lib to submit transactions over web sockets.
Personal tools
Namespaces

Variants
Actions
Navigation
Tools