☰
Login
Signup
Home
›
Market data (WebSockets)
Howdy, Stranger!
It looks like you're new here. If you want to get involved, click one of these buttons!
Sign In
Register
Categories
Recent Discussions
Activity
Categories
13.8K
All Categories
0
Incidents
153
Node JS client
40
Go client
793
.Net API client
378
Kite Publisher
537
.Net / VBA / Excel (3rd party)
457
Algorithms and Strategies
993
Java client
1.1K
API clients
404
PHP client
4K
Python client
346
Mobile and Desktop apps
1.4K
Market data (WebSockets)
3.3K
General
In this Discussion
November 2019
tonystark
November 2019
MW5790
Postback URL Post body malformed
MW5790
November 2019
in
Market data (WebSockets)
I use a google CLoud function to capture the Postback from Kite.
I get a malformed JSON like this.. pls help
Extra ', }
{ '{"placed_by":"PN4653","order_id":"191122003026392","exchange_order_id":"","parent_order_id":"","status":"REJECTED","status_message":"Order was placed outside of trading hours (adapter off). Try placing an AMO.","order_timestamp":"2019-11-22 23:53:20","exchange_update_timestamp":"","exchange_timestamp":"","variety":"regular","exchange":"NFO","tradingsymbol":"NIFTY19NOVFUT","instrument_token":12335874,"order_type":"LIMIT","transaction_type":"SELL","validity":"DAY","product":"NRML","quantity":75,"disclosed_quantity":0,"price":12000,"trigger_price":0,"average_price":0,"filled_quantity":0,"pending_quantity":0,"cancelled_quantity":0,"market_protection":0,"tag":"API","guid":"14109XUiJFZZdSXo1R","user_id":"PN4653","unfilled_quantity":0,"app_id":14109,"checksum":"bedaaa4c2bfefccb53cfcc20917f3c4fb56ee0ba62b2a315c494894e4282da5c"}': '' }"
Tagged:
Postback URL
MW5790
November 2019
Hi Any response or help
@tonystark
tonystark
November 2019
@MW5790
It seems the way you collect the JSON is wrong. Can you post an example code that can reproduce this?
MW5790
November 2019
This is the Nodejs called triggered from my google cloud function .. in the google console logs i see a malformed JSON
const escapeHtml = require('escape-html');
exports.broadcastUpdate = (req, res) => {
console.log('got incoming broadcast update from -', req.connection.remoteAddress);
console.log('Request Body -',req.body);
console.log('tag -',req.body.tag);
//res.status(200).send({ok: true});
console.log('Content type-',req.get('content-type'));
res.status(200).send('Source IP-'|| req.connection.remoteAddress
);
};
JSON in Google console logs
{ '{"placed_by":"PN4653","order_id":"191128003614894","exchange_order_id":"","parent_order_id":"","status":"REJECTED","status_message":"Order was placed outside of trading hours (adapter off). Try placing an AMO.","order_timestamp":"2019-11-28 21:58:01","exchange_update_timestamp":"","exchange_timestamp":"","variety":"regular","exchange":"NSE","tradingsymbol":"HDFC","instrument_token":340481,"order_type":"LIMIT","transaction_type":"BUY","validity":"DAY","product":"NRML","quantity":250,"disclosed_quantity":0,"price":2320,"trigger_price":0,"average_price":0,"filled_quantity":0,"pending_quantity":0,"cancelled_quantity":0,"market_protection":0,"tag":"API","guid":"14597XP9arePiaUj5D","user_id":"PN4653","unfilled_quantity":0,"app_id":14597,"checksum":"e0b2fad09e38cfb6eaca7c225123844641ecaf7f42960c513382b3999ca7bac6"}': '' }"
Sign In
or
Register
to comment.
@tonystark
const escapeHtml = require('escape-html');
exports.broadcastUpdate = (req, res) => {
console.log('got incoming broadcast update from -', req.connection.remoteAddress);
console.log('Request Body -',req.body);
console.log('tag -',req.body.tag);
//res.status(200).send({ok: true});
console.log('Content type-',req.get('content-type'));
res.status(200).send('Source IP-'|| req.connection.remoteAddress
);
};
JSON in Google console logs
{ '{"placed_by":"PN4653","order_id":"191128003614894","exchange_order_id":"","parent_order_id":"","status":"REJECTED","status_message":"Order was placed outside of trading hours (adapter off). Try placing an AMO.","order_timestamp":"2019-11-28 21:58:01","exchange_update_timestamp":"","exchange_timestamp":"","variety":"regular","exchange":"NSE","tradingsymbol":"HDFC","instrument_token":340481,"order_type":"LIMIT","transaction_type":"BUY","validity":"DAY","product":"NRML","quantity":250,"disclosed_quantity":0,"price":2320,"trigger_price":0,"average_price":0,"filled_quantity":0,"pending_quantity":0,"cancelled_quantity":0,"market_protection":0,"tag":"API","guid":"14597XP9arePiaUj5D","user_id":"PN4653","unfilled_quantity":0,"app_id":14597,"checksum":"e0b2fad09e38cfb6eaca7c225123844641ecaf7f42960c513382b3999ca7bac6"}': '' }"