Search code examples
restibm-cloudpostmanhyperledger

Tried running chaincode REST request in Chrome Postman


In chrome postman, my method is POST and url is localhost:5000/chaincode

Then my param, I did bulk editing and inserted this set of code.

{
  "jsonrpc": "2.0",
  "method": "deploy",
  "params": {
    "type": 1,
    "chaincodeID":{
        "path":"github.com/hyperledger/fabric/examples/chaincode/go/chaincode_example02"
    },
    "ctorMsg": {
        "function":"init",
        "args":["a", "1000", "b", "2000"]
    }
  },
  "id": 1
}

However, it returned me this set of error, which I do not understand why. I did everything as I was told.

{
  "jsonrpc": "2.0",
  "error": {
    "code": -32600,
    "message": "Invalid request",
    "data": "Client must supply a payload for chaincode requests."
  },
  "id": null
}

Does anyone know what I went wrong at?


Solution

  • Solution:

    I was using Chrome Postman to test out the API call. I didn't knew that the parameters should all be written in the body segment. Thus, after putting in all my parameters in the body segment, it works like magic.