Retrieve specific fields of contracts via API

  1. For large bulky contracts with lots of fields, is there a way to retrieve only certain specific fields of those contracts instead of the full contracts, via the json api, the websocket streaming api or the gRPC api? Are contracts only always returned in their entirety?

  2. If a choice returns an Int or a data record instead of a contract, can the submitter of the choice exercise access this return value in any way?

1 Like

For 1, unfortunately there is no way to retrieve only parts of a contract. You always get the full contract.

For 2, the response on submitting an exercise includes an exerciseResult field. That matches whatever the choice returned in Daml. See HTTP JSON API Service — Daml SDK 1.16.0 documentation for the docs.