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?
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.
yes sure - you would use the
/api/system/issueIdentity
operation as inhttp://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 using
setDefault` 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'
where orguser1 is your participant already created in Composer. Hope this helps.
I'm able to execute the curl command as provided by Mr O'Mahony. However, I don't know how to deal with the response I got back (please see below). Does anyone have javascript example code to handle the response? Thanks.
PK �|eL��gDconnection.json{"name":"hlfv1","type":"hlfv1","orderers":[{"url":"grpc://localhost:7050"}],"ca":{"url":"http://localhost:7054","name":"ca.org1.example.com"},"peers":[{"requestURL":"grpc://localhost:7051","eventURL":"grpc://localhost:7053"}],"channel":"composerchannel","mspID":"Org1MSP","timeout":300}PK �|eL�/ metadata.json{"userName":"voter114","version":1,"enrollmentSecret":"JoKCZAJxTfic","businessNetwork":"voting-network"}PK �|eL��gDconnection.jsonPK �|eL�/