Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/ContractId for Template and InterfaceForum ↗

ContractId for Template and Interface

App Development2 posts227 views1 likesLast activity Jul 2023
WI
wilsonhsu0102OP
Jul 2023

Hi Team,

Recently discovered that via HTTP JSON API, fetch_by_contract_id on an interface ContractId without providing templateId nor interfaceId would 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,

ST
Stephen
Jul 2023
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.

← Back to Discussions