Using Postman to Explore the Ledger API

Background

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.

You might consider additionally Using gRPC UI to Explore the Ledger API. Both Postman and gRPC UI have their advantages.

These notes are based on:

  • macOS
  • Daml SDK 2.4
  • Postman Version 10.6.7 (updated Dec 14, 2022)

API Setup

  1. Start the Sandbox ledger.

    daml sandbox
    
  2. In Postman, use File → New… to create a new “gRPC Request”.

  3. For “Enter Server URL” use localhost:6865. Postman’s service reflection will automatically list the available methods.

  4. For “Select a Method” select “GetLedgerApiVersion” and press “Invoke.”

  5. View the response from the service, in JSON format.

  6. Repeat these steps for the other service endpoints that you would like to use. See the Ledger API documentation for the expected message bodies for the various service endpoints.

3 Likes

Hi Wallace, that’s a great write-up.

Was this written and tested solely on MacOS?

@Ben_M Yes, I did this on a macOS. Great question. I updated the post to include that note.

You don’t happen to use a Windows machine do you?

1 Like

No, I am one of the lucky company minority using GNU/Linux :grinning:

Nice, thanks for sharing.

To clarify, “server reflection” in general should work but unfortunately breaks for the Ledger API due to a bug that is open at the time of writing. Hopefully it will be fixed in the future.

1 Like

I have done something similar on Windows and it worked. In general I would expect it to be working regardless of the underlying OS (but of course OS-specific bugs might always arise).

Looks like the bug has been fixed in Postman v10.6.0, according to this comment, could be worth having another try.

1 Like

@stefanobaghino-da Thank you for noticing that! I have updated this guide. It is much simpler now.

1 Like