Is there a way to get the new package id, after a ledger migration, using the JSON API?

So I know we can get the package id using daml damlc inspect-dar, and I know we can get a list of packages using the JSON API’s GET /v1/packages, but I cannot immediately tell from this list which one is the main package id. The scenario is that after we make a change to the ledger and “migrate” it, the various services that access it need to know what the new package id is. Is there a way to get the package id using the JSON API? Other than, say, retrieving a known contract and getting the package id from the template id?

Hi @CoNan and welcome to the forum!

You can’t do that check via the JSON API. The JSON API just knows about a lit of packages, it has no concept of the latest version of a given package or even a concept of DARs and therefore also not the main package of a DAR.

daml damlc inspect-dar is usually your best option here if you are not using one of the codegens which will automatically include package ids in your requests.

Thanks, @cocreature, for the welcome, and for the quick reply! Good to have a definitive answer, as our team considers various solutions.

1 Like