kc.getIntruments call is failing when passing an array of strings example ['NSE' ,'BSE' ]

RishabhBhanot17
kc.getIntruments call is failing when passing an array of strings example ['NSE' ,'BSE' ] and is working for single exchange value. Can you please help fix this

async getInstruments(userId: string, segments: string[]): Promise {
try {
console.log("entered Get Instruments Service")
const kiteClient= await this.kiteConnectPool.getClient(userId);
console.log(kiteClient)
const response = await kiteClient.getInstruments(segments);
return response;
} catch (error) {
console.log(error)
throw error;
}
}


@Get('instruments')
async getInstruments(
@Query('userId') userId: string,
@Query('segment') segment: string[],
): Promise {
console.log(typeof(segment));
console.log(segment);
console.log("entered Get Instruments Controller")
return this.kiteClientService.getInstruments(userId, segment);
}





http://localhost:3000/kite-client/instruments?userId=&segment=BSE&segment=NFO&segment=MCX


Getting this error
{ message: 'Forbidden', error_type: 'NetworkException', data: null }
[Nest] 8020 - 03/19/2024, 1:17:18 AM ERROR [ExceptionsHandler] Forbidden



and this API is working without any authorization is this by default or there is some issue because I saw in the http documentation auth is required
Sign In or Register to comment.