ContractId for Template and Interface
- wilsonhsu0102OP
Hi Team,
Recently discovered that via HTTP JSON API,
fetch_by_contract_idon an interface ContractId without providingtemplateIdnorinterfaceIdwould give us the template object. Is this a deterministic behaviour that it will always give us the template object?Does a template and its interface have the same contractId?
Thanks,
- Stephen 1
wilsonhsu0102:Is this a deterministic behaviour that it will always give us the template object?
Yes.
wilsonhsu0102:Does a template and its interface have the same contractId?
That’s correct, contract IDs are distinguished solely by static type in Daml and various codegens. So you could say that you have supplied “a contract ID” rather than “an interface ContractId”.
If we were to design the JSON API now, we would probably not allow you to leave off the template or interface ID. But the API precedes the introduction of interfaces, and the prior behavior of that endpoint was to return the template payload on such requests as you describe, and so it must continue to do that.