const url = 'https://api.dhan.co/orders';
const options = {
method: 'POST',
headers: {
'access-token': 'X',
'Content-Type': 'application/json',
Accept: 'application/json'
},
body: '{"dhanClientId":"string","correlationId":"string","transactionType":"BUY","exchangeSegment":"NSE_EQ","productType":"CNC","orderType":"LIMIT","validity":"DAY","tradingSymbol":"string","securityId":"string","quantity":-2147483648,"disclosedQuantity":-2147483648,"price":-3.402823669209385e+38,"triggerPrice":-3.402823669209385e+38,"afterMarketOrder":true,"amoTime":"OPEN","boProfitValue":-3.402823669209385e+38,"boStopLossValue":-3.402823669209385e+38,"drvExpiryDate":"string","drvOptionType":"CALL","drvStrikePrice":-3.402823669209385e+38}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
POST https://api.dhan.co/orders 403 (Forbidden)
“Invalid CORS request” is not valid JSON