What components does the JSON API pass its data to?

So as I understand it the JSON API itself is fairly simple, it doesn’t do any validation, nor authorization. It receives commands and passes them on to other parts of the DAML stack. Is it essentially a translation layer for the Ledger API or does it talk to any other components?

That’s right. It’s best to think of it as something any ordinary gRPC client could do.

The only special thing it does from downstream perspective is to keep a list of templates so that package IDs may be inferred. That list, too, is maintained over an ordinary gRPC client connection, as described here.

However, you should not take the corollary that there is an obvious 1-1 mapping between a gRPC call and a JSON API request. Each endpoint tries to add some value to the underlying gRPC call[s]

  1. by simplifying the protocol, e.g. removing uncommonly used arguments or trying to infer required arguments such as with package IDs, or
  2. by doing something nice internally, such as the query language that helps you filter what might otherwise be a firehose of contracts.
2 Likes

Just for the references, here is the list of all Ledger API calls that JSON API relies on (scroll down to find the implementations):

1 Like

Thanks for the answers. These are very helpful!