Error With Rest Server HyperLedger

0 votes

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 

Nov 9, 2018 in Blockchain by Perry
• 17,100 points
1,101 views

1 answer to this question.

0 votes

It's a trivial issue mate - you're just missing the close quotes from org.acme.biznet.Trader in your input :)

answered Nov 9, 2018 by Christine
• 15,790 points

Related Questions In Blockchain

0 votes
1 answer

Why hyperledger REST server has PUT method?

Actually, with the PUT method, you don't ...READ MORE

answered Jul 19, 2018 in Blockchain by aryya
• 7,460 points
612 views
0 votes
1 answer
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,470 views
+1 vote
1 answer
0 votes
1 answer

Unable to request channel creation using Rest Api

I'd recommend taking a look at the ordering ...READ MORE

answered Jul 16, 2018 in Blockchain by Perry
• 17,100 points
904 views
0 votes
1 answer

Hyperledger Composer rest server NPM versions

The Hyperledger Composer pre-requisites can be installed ...READ MORE

answered Jul 13, 2018 in Blockchain by Christine
• 15,790 points
869 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP