Hi, we’re using the endpoont /auth/ledger/{{LedgerID}}/parties to retrieve information about our parties created on the ledger and now getting to a point where I have a concern about productivity (too many parties created)
is it possible to filter the response of this endpoint by party name or ID?
We do not have filtering functionality on our party listing endpoints. You defining a list of known IDs in the body of a POST request, the result should list which of those IDs correspond to a party on the ledger and which are “unknown”.
There are a few use cases for using the listing of parties, and different recommended solutions would apply for the different use cases.
Correlating a party create request with a newly created party literal (Daml Hub-specific)
We are working on general improvements to party allocation over the next few months that should make it easier for you to correlate a request for a new Party with the allocated Party; right now, the aforementioned endpoint is the only way to get at this information, and unfortunately you do indeed need to download the whole list to find the new party.
We use a similar technique within Daml Hub as well, and internally we manage tens of thousands of identities. It’s definitely not quick, but it’s a workflow that happens once per user, forever, so you may find that the performance, even for large numbers of parties, is actually acceptable.
Searching for existing “users”
The party listing endpoint is really only an identity discovery endpoint, and can’t speak to specific use cases. Creating a template whose contracts correspond to your users/actors of the system is the recommended approach:
template Customer
where
operator : Party
party : Party
name : Text
address : Text
...
template Supplier
where
operator : Party
party : Party
name : Text
...
Then you can filter these contracts using the HTTP JSON API on attributes that you additionally define above and beyond the identities of these parties, using attributes as they pertain to your use-case.