This page documents how to setup Postman to explore the Ledger API. You may already be familiar with using Postman to query JSON API endpoints. In 2022, Postman added support for gRPC endpoints. The Ledger API is a collection of gRPC endpoints.
These notes are based on:
- Daml SDK 2.4
- Postman Version 10.4.2
- UI Version: 10.4.2-ui-221121-1032
- Desktop Platform Version: 10.1.2 (10.1.2)
Postman’s support for gRPC is not 100% compatible with the Ledger API. For example:
The “server reflection” feature does not work. This is the feature that queries for the endpoints and types. Instead, you will need to point Postman to proto files for that information.
Postman does not work with the “server streaming” endpoints. For example, the Ledger API’s TransactionService has
GetTransactionTreesendpoints. These two endpoints stream results. Postman does not work with these two endpoints.
Due to these limitations, you might consider additionally Using gRPC UI to Explore the Ledger API. Both Postman and gRPC UI have their advantages.
Clone the daml repository, if you don’t already have it locally. You need this for the .proto files.
git clone https://github.com/digital-asset/daml.git
Start the Sandbox ledger.
In Postman, use File → New… to create a new “gRPC Request”.
For “Enter Server URL” use
localhost:6865. For “Select a Method” use “Import a .proto file.”
Navigate on your local drive to
Click on “Add an import path” and add
daml/ledger-api/grpc-definitions( not the full path to the
Click Next, enter an API name for Postman (e.g,
Ledger API Version Service), and click “Import as API”.
For “Select a Method” select “GetLedgerApiVersion” and press “Invoke.”
View the response from the service, in JSON format.
Repeat these steps for the other .proto files that you would like to use. See the Ledger API documentation for the expected message bodies for the various service endpoints.