v2.
Consult the JSON Ledger API reference for exact details and usage.
Create a New Contract
- v1 endpoint:
POST/v1/create - v2 equivalent:
POST/v2/commands/submit-and-wait
JsCommands request body, add a CreateCommand object (wrapping your v1 create payload) as an element of the commands array.
There is also an alternate endpoint, /v2/commands/submit-and-wait-for-transaction, which can be used instead of /v2/commands/submit-and-wait to get more data about the processed transaction. To receive tree-equivalent data, set transactionFormat.transactionShape to TRANSACTION_SHAPE_LEDGER_EFFECTS in the request. (/v2/commands/submit-and-wait-for-transaction-tree is deprecated and slated for removal; do not migrate to it.)
Create a Contract with a Command ID
- v1 endpoint:
POST/v1/create - v2 equivalent:
POST/v2/commands/submit-and-wait
meta.commandId field, while in v2 commandId is a required top-level field of the JsCommands object.
Exercise by Contract ID
- v1 endpoint:
POST/v1/exercise - v2 equivalent:
POST/v2/commands/submit-and-wait
JsCommands request body, add an ExerciseCommand object as an element of the commands array.
Exercise by Contract Key
- v1 endpoint:
POST/v1/exercise(with akeyin place of acontractId) - v2 equivalent:
POST/v2/commands/submit-and-wait
JsCommands request body, add an ExerciseByKeyCommand object as an element of the commands array. Contract keys in Canton 3.x require the template to be compiled against Daml-LF 2.3 or later (the default target is 2.2, which has no contract keys) and a synchronizer running protocol version 3.5 or later. Unlike v1, contract keys are non-unique: key uniqueness is not enforced.
Create and Exercise in the Same Transaction
- v1 endpoint:
POST/v1/create-and-exercise - v2 equivalent:
POST/v2/commands/submit-and-wait
JsCommands request body, add a CreateAndExerciseCommand object as an element of the commands array.
Fetch Contract by Contract ID
- v1 endpoint:
POST/v1/fetch - v2 equivalent:
POST/v2/events/events-by-contract-id
Fetch Contract by Key
- v1 endpoint:
POST/v1/fetch - v2 equivalent: no direct replacement
Get All Active Contracts
- v1 endpoint:
GET/v1/query - v2 equivalent:
/v2/state/active-contracts
activeAtOffset), obtain it via a call to /v2/state/ledger-end.
There is also a streaming version of this endpoint in V2, which uses websockets. It provides better scalability for large results. Alternatively, POST /v2/state/active-contracts-page returns the active contract set in pages over plain HTTP.
Get All Active Contracts Matching a Given Query
-
v1 endpoint:
GET/v1/query -
v2 equivalent: no direct replacement
-
Option 1: use
/v2/state/active-contractsand query result in client code - Option 2: use PQS (suitable for more demanding use cases)
-
Option 1: use
Fetch Parties by Identifiers
- v1 endpoint:
POST/v1/parties - v2 equivalent:
GET/v2/parties/<party-id>
Fetch All Known Parties
- v1 endpoint:
GET/v1/parties - v2 equivalent:
GET/v2/parties
Allocate a New Party
- v1 endpoint:
POST/v1/parties/allocate - v2 equivalent:
POST/v2/parties
Create a New User
- v1 endpoint:
POST/v1/user/create - v2 equivalent:
POST/v2/users
Get Authenticated User Information
- v1 endpoint:
GET/v1/user - v2 equivalent:
GET/v2/authenticated-user
Get Specific User Information
- v1 endpoint:
POST/v1/user - v2 equivalent:
GET/v2/users/<user-id>
Delete Specific User
- v1 endpoint:
POST/v1/user/delete - v2 equivalent:
DELETE/v2/users/<user-id>
List Users
- v1 endpoint:
GET/v1/users - v2 equivalent:
GET/v2/users
Grant User Rights
- v1 endpoint:
POST/v1/user/rights/grant - v2 equivalent:
POST/v2/users/<user-id>/rights
Revoke User Rights
- v1 endpoint:
POST/v1/user/rights/revoke - v2 equivalent:
PATCH/v2/users/<user-id>/rights
List Authenticated User Rights
- v1 endpoint:
GET/v1/user/rights - v2 equivalent:
GET/v2/users/<user-id>/rights
List Specific User Rights
- v1 endpoint:
POST/v1/user/rights - v2 equivalent:
GET/v2/users/<user-id>/rights
List All DALF Packages
- v1 endpoint:
GET/v1/packages - v2 equivalent:
GET/v2/packages
Download a DALF Package
- v1 endpoint:
GET/v1/packages/<package-id> - v2 equivalent:
GET/v2/packages/<package-id>
Upload a DAR File
- v1 endpoint:
POST/v1/packages - v2 equivalent:
POST/v2/dars
POST /v2/packages behaves identically; prefer /v2/dars.
Metering Report
- v1 endpoint:
/v1/metering-report - v2: no direct replacement, metering has been removed
Streaming API
Contracts Query Stream
- v1 endpoint:
websocket/v1/stream/query - v2 equivalent:
websocket/v2/state/active-contracts
Fetch by Key Contracts Stream
-
v1 endpoint:
websocket/v1/stream/fetch -
v2: no direct replacement
- Option 1: Use PQS
- Option 2: Use
/v2/state/active-contractswith client-side filtering (for infrequent queries).