Skip to content
Discussions/App Development/Use Postman for async endpoints on the Ledger JSON APIForum ↗

Use Postman for async endpoints on the Ledger JSON API

App Development2 posts66 views2 likesLast activity Jan 2025
WA
WallaceKellyOP
Jan 2025

Some of the endpoints on the Ledger JSON API are WebSocket endpoints. For example:

  • /v2/state/active-contracts
  • /v2/updates/flats
  • /v2/updates/trees
  • /v2/commands/completions

I know how to call such endpoints with wscat.

How do I call those endpoints with Postman?

WA
WallaceKelly
Jan 2025

Take as an example, this successful wscat call:

wscat --connect ws://localhost:7575/v2/updates/trees \
   --subprotocol 'daml.ws.auth' \
   --subprotocol 'jwt.token.eyJhbG...' \
   --execute '{ "verbose": true, "beginExclusive": "0", "filter": { "filtersByParty" : { "Alice::12207...": { "cumulative": [] } } } }'
  1. In Postman, create a WebSocket request.

  2. Set the URL, using ws: as the protocol:

  3. Add a Sec-WebSocket-Protocol header with a comma separated list of the “subprotocols.” No braces; no quotes.

  4. Press the “Connect” button.

  5. On the Message tab, “Send” a message.

    Sample message
    {
      "verbose": true,
      "beginExclusive": "0",
      "filter": {
        "filtersByParty": {
          "Alice::12207...": {
            "cumulative": []
          }
        }
      }
    }
    
  6. In the Response pane, see the response message.

    Sample response

← Back to Discussions