How to frame json request for fetching RIC values for multiple ISIN values using java?
This is the json request:
JSONObject searchJSONObject = new JSONObject();
searchJSONObject.put(
"SearchRequest",
new JSONObject()
.put("IdentifierType", "Isin")
.put("Identifier",
new JSONArray().put("ISIN1").put("ISIN2"))
.put("PreferredIdentifierType", "Ric"));
I am getting the following error:
org.apache.http.client.HttpResponseException: Bad Request
Is this the correct way to frame the request? If not, how else can it be done?
Best Answer
-
@meera_c, your code generates an array of instruments, but as pointed out by Veerapath, if you want several they should all be in a single string.
This is the request generated by the code in your query:
{"SearchRequest":{"PreferredIdentifierType":"Ric","Identifier":["ISIN1","ISIN2"],"IdentifierType":"Isin"}}
This is what is required:
{"SearchRequest":{"PreferredIdentifierType":"Ric","Identifier":"ISIN1, ISIN2","IdentifierType":"Isin"}}
So the code should be along these lines:
JSONObject searchJSONObject = new JSONObject()
.put("SearchRequest", new JSONObject()
.put("IdentifierType", "Isin")
.put("Identifier", "ISIN1, ISIN2")
.put("PreferredIdentifierType", "Ric"));But again, as mentioned in my previous comment, using InstrumentSearch for more than 1 ISIN has severe limitations, I do not recommend using it that way.
0
Answers
-
@meera_c, you can start by downloading the Java samples, available under the downloads tab. That will give you a good framework for experimenting, and a set of working requests. The samples are described in a readme file, and there is also some information here.
The programming without SDK tutorial explains how the HTTP requests that interact with the TRTH REST API are built in Java.
Finally, calls to convert ISINs to RICs are explained in full detail in this article.
0 -
I guess that the endpoint is InstrumentSearch. Please correct me if i'm wrong.
You can add multiple identifiers in the "Identifier" parameter with comma-separated.
The code should be:
.put("Identifier", "ISIN1,ISIN2")
For more information, please see the Search by RIC - HTTP request section in this tutorial.
0 -
Thanks for the information! However, I was only able to find information regarding convertion of ISIN to RIC for a single ISIN in one json request. What I would like to know is, if its possible to convert multiple ISIN to RIC using a single json request?
0 -
Thanks for your help! However i am still facing the same issue, that its not a valid json request.
0 -
@meera_c, that depends on the exact ISIN to RIC use case and call you use; some will take multiple ISINs, others will only take one.
For instance, if you want to find the current primary RIC for an ISIN, it is done using a T&C API call, which takes multiple ISINs, as illustrated in the article. Same goes for finding historical RICs for 1 or more exchanges using a historical reference call.
But the search calls (like the one in your query) only take one ISIN.
In the article, most of the cases where a call can take several ISINs, it is illustrated with several.
0 -
Can you share the complete code section, so that we can identify the issue. You can also dump httpPost request messsage using something like:
System.out.println(httppost.toString());
for(org.apache.http.Header hdr : httppost.getAllHeaders())
System.out.println(hdr);
httppost.getEntity().writeTo(System.out);0 -
@meera_c, this will work ... up to a point. There are limitations:
- The string that contains all the identifiers cannot exceed a length of 50 characters (if it does, an error will be returned).
- The output is not configurable, and does not contain the input ISIN. As there are many RICs for an ISIN, you will not be able to easily map your input ISINs to the output RICs.
For ISIN to RIC conversion I would not use InstrumentSearch for more than 1 ISIN.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 690 Datastream
- 1.5K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 560 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 721 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛