通过Node.js使用API的新合同实例 [英] New contract instance using API through Node.js
问题描述
您好,
我正在尝试在SimpleMarketplace演示中创建一个新的合约实例,但是没有关于使用Node.js对api执行发布请求的官方文档,所以我一直在尝试与邮差和完美的工作。然而,自从从以下网站导入集合后,让我有点困惑
:https://github.com/Azure-Samples/blockchain/tree/master/blockchain-workbench/rest-api-samples/postman models the通过取出workflowActionInput变量来发布请求正文:
As你可以看到工作得很好而且很完美。但是当从Node.js运行此代码时:
我尝试从body中取出workflowActionInput或将变量括在doble引号中(如postman所做),但是console.log仍会输出此错误:
你能否至少给一个例如,通过Node.js发送帖子请求,就像你在这里一样使用python,java和dotnet,https://github.com/Azure-Samples/blockchain/tree/master/blockchain-workbench/rest-api-samples。 / p>
另外,发现应用程序洞察中记录了一个错误。显然,交易不是从邮递员那里提交的:
嗨 yieniggu I
会建议您在共享的存储库上打开一个问题,请求Node.js的示例。
您是否设法 POST请求成功使用 Postman?
编辑:我看到您在回购中创建了一个问题,并且您正在与工程师进行交流
https://github.com/Azure-Samples/blockchain/issues/146
Hello,
I'm trying to create a new contract instance on SimpleMarketplace demo but there's no official documentation about performing post requests to the api using Node.js so i've been trying with postman and works perfectly. However is getting me a little confused since the collection imported from: https://github.com/Azure-Samples/blockchain/tree/master/blockchain-workbench/rest-api-samples/postman models the post request body by taking out the workflowActionInput variable:
As you can see is working nice and perfectly. However when run this code from Node.js:
I've tried taking out the workflowActionInput from the body or enclosing the variables in doble quotes (as postman does), but still the console.log outputs this error:
Can you at least give an example on making a post request through Node.js as you do here https://github.com/Azure-Samples/blockchain/tree/master/blockchain-workbench/rest-api-samples with python, java and dotnet.
Additionaly, found an error logged in application insights. Apparently the transaction wasn't submitted either from postman:
Hi yienigguI would suggest you to open an issue on that repository you are sharing requesting a sample for Node.js.
Have you managed to make the POST request successfully with Postman?
Edit: I saw that you created an issue on the repo and you are engaging with an engineer there https://github.com/Azure-Samples/blockchain/issues/146
这篇关于通过Node.js使用API的新合同实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!