Asked by:
post contract via rest api from postman by impersonating a user

Question
-
Hi, if I am using postman to impersonate a user to post a contract, can that work?
In my situation, when I tried to post a new contract, I get a 200 OK, and I can see that a new contract is created by Get api/v2/contracts.
However, the contract has no ledgerIdentifier, and when I try Get api/contract/{contractId}/actions from the user who created the contract, it returns me 204. FYI, the user who creates the contract should be able to take one action.
The following is the contract info I get through postman by calling Get api/v2/contract/{contractId}
``
"id": 12,"provisioningStatus": 0,"timestamp": "2019-08-15T18:41:49.5566667","connectionID": 1,"ledgerIdentifier": null,"deployedByUserId": 1,"workflowId": 2,"requestId": "7140c8cd-8174-46af-8c1e-bb0717e02073","contractCodeId": 2,"contractProperties": [],"transactions": [],"contractActions": [{"id": 30,"userId": 1,"provisioningStatus": 0,"timestamp": "2019-08-15T18:41:49.5566667","parameters": [{"name": "description","value": "from postman","workflowFunctionParameterId": 9},{"name": "transferability","value": "true","workflowFunctionParameterId": 10},{"name": "expired time","value": "1569011400","workflowFunctionParameterId": 11}],"workflowFunctionId": 7,"transactionId": null,"workflowStateId": null,"requestId": "7140c8cd-8174-46af-8c1e-bb0717e02073","eventId": null}]``
My questions are:
1.what could possibly go wrong here?
2.why there is no ledgerIdentifier and contractProperties for the contract?
Thanks
Really appreciate your help on this!!!!!
All replies
-
Could you please include more details on your post request like the call header and body format,
- Edited by Alberto Vega (Azure)Microsoft employee, Moderator Friday, August 23, 2019 2:14 AM
-
-
-
The lack of ledgerIdentifier of field implies that the contract/app was created in Workbench's database but not committed to the distributed ledger yet. Are other contract creations that you try coming back with a ledgerIdentifier? Do you see a Transaction ID in the UI when you take actions on a contract? I'm not sure what you mean by impersonating a user. Please provide some more context. Thanks.
For debugging issues, please use the Workbook feature that is documented here: https://github.com/Azure-Samples/blockchain/blob/master/blockchain-workbench/faq/troubleshooting.md and let us know what you find out so we can help more. Without access to the deployment, is hard for us to debug efficiently and the application insights logs allow you to self-service debug most issues.
Microsoft Azure Blockchain Team
- Proposed as answer by Alberto Vega (Azure)Microsoft employee, Moderator Monday, September 16, 2019 9:36 PM