How to create participant , there identities via r

2019-07-07 17:31发布

问题:

I have created bna and deployed in composer rest server by enabling passport and multi-user, How to create participant, their identities via rest API that generated by composer rest server without importing cards via import wallets? and there is no proper documentation for this.

回答1:

assuming you've done a /Wallet/Import of an identity that can issue other identities:

eg. REST Endpoint

/Wallets/Import

browse for file your exported admin card eg. netadmin.card and Import it. use the POST /wallet/{name}/setDefault REST method if you need to set this as the default id.

you would then do:

Add a participant (say a participant called trader1):

- eg. say 'Trader'

Post /Trader

{
  "$class": "org.acme.trading.Trader",
  "tradeId": "trader1",
  "firstName": "John",
  "lastName": "Doe"
}

Issue an identity mapped to that participant above (say jdoe):

Under /System;

POST /system/identities/issue:
{

"participant": "resource:org.acme.trading.Trader#trader1", "userID": "jdoe", "options": {} }

You should get a business network card in your Downloads folder - from your REST server go to /Wallets

/POST /wallet/import

Import the wallet, giving it the userId@your-network parameter when prompted. Then set that as the default user (eg /POST wallet/{name}/setDefault ) if you want to use it in your browser.