IBM-Blockchain-Archive / fabric-boilerplate

Get up and running quickly with your own blockchain application!
Apache License 2.0
79 stars 150 forks source link

Cannot invoke createThing Via REST #43

Open dconroy opened 7 years ago

dconroy commented 7 years ago

After enrolling a user in the rest API: Post:http://localhost:7050/registrar {"enrollId":"test_user0","enrollSecret" :"MS9qrN8hFjlE"} Response: { "OK": "Login successful for user 'test_user0'."} I am then unable to create a new thing via invoke/rest POST:http://localhost:7050/chaincode

{
   "jsonrpc":"2.0",
   "method":"invoke",
   "params":{
      "type":1,
      "chaincodeID":{
         "name":"a2abd8f6ca44ea7287003028698edcf723f27f248bd12c8c5f31d5d26a8dd94b"
      },
      "ctorMsg":{
         "function":"createThing",
         "args":[
            {
               "thingID":"6a0a2ac8-e34b-e111-a1e3-00155d690d2a",
               "userID":"084003277",
               "description":"State  Committee",
               "someProperty":"124914266456"
            }
         ]
      },
      "secureContext":"test_user0"
   },
   "id":0
}

Response:

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32700,
    "message": "Parse error",
    "data": "Error unmarshalling chaincode request payload: json: cannot unmarshal object into Go value of type string"
  },
  "id": null
}
dconroy commented 7 years ago

FYI i did add an extra field called description to the thing entity but that shouldnt be related to this error. Same issue with adding users as well.

rbecsi-andigital commented 7 years ago

Hi @dconroy Can you please send the relevant Go chaincode for reference. Thanks