为不在 RestAPI 上工作但在命令行中工作的参与者颁发身份

Issuing an Identity for a Participant not working on RestAPI, but it does in Command Line

我已经使用开发环境教程中提供的 Fabric 部署了自定义 .bna。然后,我启动了 composer-rest-server 如下:

composer-rest-server -p hlfv1 -n bonusetis -i admin -s adminpw -N never

然后,我创建了一些参与者,并尝试在 RestAPI Loopback(在 3000/explorer)中发出一个身份,它发送一个

curl -X POST --header 'Content-Type: application/json' --header 'Accept: application/json' -d '{ \ 
   "participant": "gemma", \ 
   "userID": "gemmatarres" \ 
 }' 'http://localhost:3000/api/system/issueIdentity'

但我收到以下错误:

{
  "error": {
    "statusCode": 500,
    "name": "Error",
    "message": "error trying invoke chaincode. Error: chaincode error (status: 500, message: Error: Invalid fully qualified participant identifier)",
    "stack": "Error: error trying invoke chaincode. Error: chaincode error (status: 500, message: Error: Invalid fully qualified participant identifier)\n    at _initializeChannel.then.then.then.then.catch (/usr/lib/node_modules/composer-rest-server/node_modules/composer-connector-hlfv1/lib/hlfconnection.js:839:34)"
  }
}

但是当我使用命令行尝试相同的操作时,如:

composer identity issue -n 'bonusetis' -i admin -s adminpw -u danigranados -a "org.basetis.bonusetis.user#dani" -p hlfv1

命令成功,身份已创建。我曾尝试与不同的参与者取得相同的结果。此外,尽管有错误,如果我尝试使用相同的用户 ID 发布新身份,我会收到错误消息,然后它说该身份已经注册。

版本都是最新的 composer (0.9.1) 和 Fabric (RC1)。

路易斯

我认为问题在于您需要在 'curl' 命令中输入 'fully-qualified' 参与者姓名。

所以:

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

其中 orgadmin1 是您已添加的参与者,'dave' 是您的身份。