When would you use a Command Id with the JSON API?

In the docs we have a section that describes creating a contract and specifying a meta field that contains a commandId. If you specify a commandId where would you use it in the future with the JSON API or does it not get used with the JSON API?

https://docs.daml.com/json-api/index.html#create-a-new-contract-with-an-optional-meta-field

It’s passed through unaltered as the command_id to the underlying ledger.

You can’t use it anywhere else in the JSON API, but you can use it for observing the results of its commands outside the JSON API. For example, it might appear in a log message, so you could correlate those logs with a specific JSON API request. Or you might have an external, more low-level gRPC client that listens for completion of specific JSON API requests’ commands.

2 Likes