Search code examples
hyperledger-fabrichyperledger-composer

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


I have deployed a custom .bna using the Fabric provided in the developer environment tutorial. Then, I started the composer-rest-server as follows:

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

Then, I created some participants, and tried to issue an identity within the RestAPI Loopback (at 3000/explorer), where it sends a

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

but I got the following error:

{
  "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)"
  }
}

But when I try the same using the Command Line, as:

composer identity issue -n 'app' -i admin -s adminpw -u username -a "org.company.app.user#bob" -p hlfv1

The Command is successful and the identity created. I have tried with different participants with the same result. Also, despite the error, if I try to issue a new identity with the same userID I got the error, then it says that the identity is already registered.

Versions are all latest composer (0.9.1) and Fabric (RC1).


Solution

  • Lluis

    I believe the problem is you need the 'fully-qualified' participant name in your 'curl' command.

    So:

    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'

    where orgadmin1 is your participant already added and 'dave' is your identity.