@Moderator_3 said in Error in getSearchScrip:
e whie running the same code we are getting the output
I have tried again but for first symbol i am getting output "SBIN-EQ" but for seconds and third symbol it is giving error
@Moderator_3 said in Error in getSearchScrip:
e whie running the same code we are getting the output
I have tried again but for first symbol i am getting output "SBIN-EQ" but for seconds and third symbol it is giving error
Sample Code
JSONObject object = new JSONObject();
object.put("exchange","NSE");
object.put("searchscrip","SBIN-EQ");
String result = smartConnect.getSearchScrip(object);
System.out.println(result);
object.put("exchange","NSE");
object.put("searchscrip","ATGL-EQ");
result = smartConnect.getSearchScrip(object);
System.out.println(result);
object.put("exchange","NSE");
object.put("searchscrip","ICEMAKE-EQ");
result = smartConnect.getSearchScrip(object);
System.out.println(result);
WHen i run this code. it is giving token for first script but in second script giving below error.
[6:43 PM] Milan Pithiya
Sample Code
JSONObject object = new JSONObject();
object.put("exchange","NSE");
object.put("searchscrip","SBIN-EQ");
String result = smartConnect.getSearchScrip(object);
System.out.println(result);
object.put("exchange","NSE");
object.put("searchscrip","ATGL-EQ");
result = smartConnect.getSearchScrip(object);
System.out.println(result);
object.put("exchange","NSE");
object.put("searchscrip","ICEMAKE-EQ");
result = smartConnect.getSearchScrip(object);
System.out.println(result);
OUTPUT
Search successful. Found 1 trading symbols for the given query:
[ERROR] [] [clientInboundChannel-9] [com.angelbroking.smartapi.http.SmartAPIRequestHandler.postRequestJSONObject(SmartAPIRequestHandler.java:446)] - Error in POST request. Request URL: https://apiconnect.angelbroking.com/rest/secure/angelbroking/order/v1/searchScrip, Request Headers: Content-Type: application/json
Authorization: ??
X-ClientLocalIP: <ip>
X-ClientPublicIP: <publicIp>
X-MACAddress: <mac>
Accept: application/json
X-PrivateKey: <key>
X-UserType: USER
X-SourceID: WEB
, Request Body: {"exchange":"NSE","searchscrip":"ATGL-EQ"},Response : Unrecognized token 'Access': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 7]
[ERROR] [] [clientInboundChannel-4] [com.angelbroking.smartapi.SmartConnect.getSearchScrip(SmartConnect.java:750)] - IOException occurred while generating session Unrecognized token 'Access': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 7]
[ERROR] [] [clientInboundChannel-4] Excception ::
java.io.IOException: The operation failed to execute because of an IO error. in generating Session Unrecognized token 'Access': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
at [Source: REDACTED (StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION
disabled); line: 1, column: 7]
at com.angelbroking.smartapi.SmartConnect.getSearchScrip(SmartConnect.java:751) ~[smartapi-java-2.2.3.jar:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_172]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_172]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_172]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_172]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:171) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.handler.invocation.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:120) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.handler.invocation.AbstractMethodMessageHandler.handleMatch(AbstractMethodMessageHandler.java:550) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler.handleMatch(SimpAnnotationMethodMessageHandler.java:510) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler.handleMatch(SimpAnnotationMethodMessageHandler.java:94) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.handler.invocation.AbstractMethodMessageHandler.handleMessageInternal(AbstractMethodMessageHandler.java:505) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.handler.invocation.AbstractMethodMessageHandler.handleMessage(AbstractMethodMessageHandler.java:439) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at org.springframework.messaging.support.ExecutorSubscribableChannel$SendTask.run(ExecutorSubscribableChannel.java:144) ~[spring-messaging-5.1.15.RELEASE.jar:5.1.15.RELEASE]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_172]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_172]
at java.lang.Thread.run(Thread.java:748) ~[?:1.8.0_172]
Error found while get secound symbol token code {"exchange":"NSE","searchscrip":"ATGL-EQ"}.
[6:44 PM] Milan Pithiya
aavu bhi lakhi samkye ke one symbol mate chale but multiple mate nahi chalti api getSearchScrip