Get Started with XAG Ledger APIs
The XAG Ledger's core server software is rippled. You can jump straight into developing on the XAG Ledger by accessing the API of a rippled
server.
The quickest way to dive into the API is with the WebSocket API Tool, or use the XAG Ledger Explorer to watch the progress of the ledger live.
You can also run your own instance of rippled
or use a public server.
Public Servers
Xrpgen provides several public servers for the benefit of the XAG Ledger community:
Operator | Network | JSON-RPC URL | WebSocket URL | Notes |
---|---|---|---|---|
Xrpgen | Mainnet | https://g4.xrpgen.com:5005/ |
wss://g4.xrpgen.com/ |
General purpose server cluster |
Xrpgen | Mainnet | https://g1.xrpgen.com:5005/ |
wss://g1.xrpgen.com/ |
Full-history server cluster |
These public servers are not for sustained or business use, and they may become unavailable at any time. For regular use, you should run your own rippled
server or contract someone you trust to do so.
Admin Access
rippled
API methods are divided into Public Methods and Admin Methods so that organizations can offer public servers for the benefit of the community. To access admin methods, or admin functionality of public methods, you must connect to the API on a port and IP address marked as admin in the server's config file.
The example config file listens for connections on the local loopback network (127.0.0.1), with JSON-RPC (HTTP) on port 5005 and WebSocket (WS) on port 6006, and treats all connected clients as admin.
WebSocket API
If you are looking to try out some methods on the XAG Ledger, you can skip writing your own WebSocket code and go straight to using the API at the Ripple WebSocket API Tool. Later on, when you want to connect to your own rippled
server, you can build your own client in the browser or in Node.js .
Example WebSocket API request:
{
"id": "my_first_request",
"command": "server_info",
"api_version": 1
}
JSON-RPC
You can use any HTTP client (like RESTED for Firefox , Postman for Chrome or Online HTTP client ExtendsClass) to make JSON-RPC calls a rippled
server. Most programming languages have a library for making HTTP requests built in.
Example JSON-RPC request:
POST https://g1.xrpgen.com:5005/
Content-Type: application/json
{
"method": "server_info",
"params": [
{
"api_version": 1
}
]
}
The response to this command shows you the current status of the server. For more information, see the server_info method.
Commandline
The commandline interface connects to the same service as the JSON-RPC one, so the public servers and server configuration are the same. By default, the commandline connects to a rippled
server running on the same machine.
Example commandline request:
rippled --conf=/etc/opt/ripple/rippled.cfg server_info
For more information on rippled
's commandline usage, see Commandline Usage Reference
Caution: The commandline interface is intended for administrative purposes only and is not a supported API. New versions of rippled
may introduce breaking changes to the commandline API without warning!