How to create token to use HTTP Json Api server in the canton?

Manju
Tue, 13 Feb 2024 12:21:54 +0000
App Development

Hi Team,

I have Canton network in the VMs. I have run the participant1 and domain in VM1 and participant2 in VM2 natively. I have started the HTTP Json api server in both the VMs. I have deployed smart contract called GenerateInputs module GenerateInputs where

template GenerateInputs
with
user : Party
dealId : Text
month : Text
year : Text
value : [Text]
where
signatory user
observer user

key user : Party
maintainer key


-- Define the SubmitGenerateInputs choice
choice UpdateGenerateInputsValue : ContractId GenerateInputs
  with
    newValue : Text
  controller user
  do
    archive self
    create this with value = newValue :: value

In the VM2, I have enable the party called Alice using the following command, participant2.parties.enable("Alice", waitForDomain=DomainChoice.All). In the postman, http://127.0.0.1:7575/v1/create {

“templateId”: “GenerateInputs:GenerateInputs”,
“payload”: {
“user” : “Alice”,
“dealId” : “testdeal1”,
“month” : “01”,
“year” : “2024”,
“value” : “30000.00”
}
} when i click sent, it throws error missing OAuth2.0 bearer token error message. so using online jwt, in the payload, i have given {
“https://daml.com/ledger-api”: {
“ledgerId”: “participant2”,
“applicationId”: “foobar”,
“actAs”: [
“Alice”
]
}
} this. but i got the error, {
“errors”: [
“INVALID_PARTY_IDENTIFIER(8,c94dc321): The given party is not a valid Canton party identifier: Unable to parse party: Invalid unique identifier Alice with missing namespace.”
],
“status”: 400
}. How to create token and how to access http json api server ? can anyone suggest how to build the typescript app and how to use http json api ?

4 posts - 3 participants