通过composer-rest-server创建卡 [英] Create Card through composer-rest-server

查看:86
本文介绍了通过composer-rest-server创建卡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能够使用composer-rest-api添加参与者,并且可以通过rest API钱包通过composer-rest-api上传卡.是否可以通过composer-rest-api创建Card?

I am able to add participant using composer-rest-api and it is possible to upload card through composer-rest-api by rest API wallet. Is it possible to create Card through composer-rest-api?

我检查了此答案 Hyperledger Composer Web应用程序用户身份验证,其中提到如何使用JavaScript API创建卡.我使用javascript代码创建了参与者并发布了它,当我运行它时($ node filename.js),它可以正常工作.我如何将其添加到rest API,我需要修改哪个文件才能将剩余服务器包括在内,创建卡.

I checked this answer Hyperledger Composer Web application user authentication, it mentions how to create card using javascript api. I used javascript code to create participant and issue it and when I run it ($node filename.js), it works fine. How can I add this to the rest API, which file exactly I need to modify for the rest server to be included create card.

推荐答案

是的-您将像http://localhost:3000/api/system/issueIdentity一样使用/api/system/issueIdentity操作-您将获得一个选项来将卡保存到文件中(未设置凭据) ,即注册ID和密码).然后,您将再次在REST中使用 http://localhost:3000导入卡(如您所做的那样) /api/wallet/import '- and specify the card file to import from a 'Browse' (explorer) button. Once you import it to the wallet in your REST client, you can set it as the default card too using setDefault`端点操作(如果需要).注册后再使用它,并确实将其导出以供其他地方使用.使用curl的示例:

yes sure - you would use the /api/system/issueIdentity operation as in http://localhost:3000/api/system/issueIdentity - you would get an option to save the card to a file (no credentials set, ie enrol ID and secret). You would then, again in REST, import the card (as you did) using http://localhost:3000/api/wallet/import'- and specify the card file to import from a 'Browse' (explorer) button. Once you import it to the wallet in your REST client, you can set it as the default card too usingsetDefault` endpoint operation if need be. Then use it once enrolled and indeed export it for use elsewhere. Example using curl:

curl -X POST --header'Content-Type:application/json'--header'Accept:application/json'-d'{\"participant":"org.acme.org.user#orguser1", \"userID":"dave" \}'' http://localhost:3000/api/system/issueIdentity '

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ "participant": "org.acme.org.user#orguser1", \ "userID": "dave" \ }' 'http://localhost:3000/api/system/issueIdentity'

其中orguser1是您在Composer中已经创建的参与者.希望这会有所帮助.

where orguser1 is your participant already created in Composer. Hope this helps.

这篇关于通过composer-rest-server创建卡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆