简体   繁体   中英

Error With Rest Server: HyperLedger

I am following the tutorial here:

https://hyperledger.github.io/composer/tutorials/queries.html#step-six-test-the-rest-apis-and-create-some-data

When I try to post the data,

I get the following response:

{
  "error": {
    "statusCode": 400,
    "name": "SyntaxError",
    "message": "Unexpected token \n in JSON at position 38",
    "body": "{\n  \"$class\": \"org.acme.biznet.Trader,\n  \"tradeId\": \"TRADER1\",\n  \"firstName\": \"Jenny\",\n  \"lastName\": \"Jones\"\n}",
    "status": 400,
    "stack": "SyntaxError: Unexpected token \n in JSON at position 38\n    at JSON.parse (<anonymous>)\n    at parse (/usr/local/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/types/json.js:88:17)\n    at /usr/local/lib/node_modules/composer-rest-server/node_modules/body-parser/lib/read.js:116:18\n    at invokeCallback (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:262:16)\n    at done (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:251:7)\n    at IncomingMessage.onEnd (/usr/local/lib/node_modules/composer-rest-server/node_modules/raw-body/index.js:307:7)\n    at emitNone (events.js:105:13)\n    at IncomingMessage.emit (events.js:207:7)\n    at endReadableNT (_stream_readable.js:1059:12)\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\n    at process._tickCallback (internal/process/next_tick.js:180:9)"
  }
}

I will appreciate any guidance on this, because as far as I can tell, I have followed the docs verbatim.

看起来您只是在输入中缺少org.acme.biznet.Trader的引号。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM