Skip to content
CCPEDIAby Unity Nodes
App Development

Stream all template types from 2.x HTTP JSON API

2 posts64 viewsLast activity Jan 2025

  1. WallaceKellyOP

    With the v1/stream/query endpoint, one can stream active contracts for a given list of template ids. For example:

    wscat --connect http://localhost:7575/v1/stream/query \
          --subprotocol 'daml.ws.auth' \
          --subprotocol 'jwt.token.eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhdWQiOiJodHRwczovL2RhbWwuY29tL2p3dC9hdWQvcGFydGljaXBhbnQvc2FuZGJveCIsInN1YiI6ImFsaWNlIiwiaXNzIjoiaWdub3JlZCJ9.uKjafJLbf4KCgBL6ys1pBT2jxs0DpflUpKX-5ZRtLVs' \
          --execute '{ "templateIds" : [ "bc6d87a0d45cb8e2a9ea194ab9d380e79ab9622695c8fa9ab6c23d764d1e0df5:Main:Asset" ] }' | jq
    

    Is there a way to subscribe to all contracts for any template (that are visible to the calling user/party)?

  2. WallaceKelly

    I conclude from the error messages returned from these filters…

    { }
    -- Object is missing required member 'templateIds'
    
    { "templateIds" : [ ] }
    -- search requires at least one item in 'templateIds'
    
    { "templateIds" : [ "*" ] }
    -- Expected JsString(<packageId>:<module>:<entity>)
    
    { "templateIds" : [ "*:*:*" ] }
    -- non expected character 0x2a in Daml-LF Package ID \"*\"
    

    …that there is no way to subscribe to all contract types.