question

Upvotes
1 2 3 4

Sample Tick History API java code below can be executed correctly, but no Template are obtained.

Sample Tick History API java code below can be executed correctly using code from Developers Portal RTH Java Code Examples, but no Template are obtained. Can you please advice.image002.png

https://developers.refinitiv.com/en/api-catalog/refinitiv-tick-history/refinitiv-tick-history-rth-rest-api/download

public void getAllReportTemplates() {
try {
String urlGet = "https://selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ReportTemplates";
HttpGet request = new HttpGet(urlGet);
request.addHeader("Authorization", "Token " + sessionToken);
HttpResponse response = httpclient.execute(request);
System.out.println("Get all report templates. HTTP status: " + response.getStatusLine().getStatusCode());
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuffer result = new StringBuffer();
String line = "";
while ((line = rd.readLine()) != null) {
result.append(line);
}
System.out.println("Report Templates received:\n" + result);
JSONObject jsonGetResponse = new JSONObject(result.toString());
String userDetail = jsonGetResponse.get("value").toString();
System.out.println("All Report Templates:\n" + userDetail);
} catch (ClientProtocolException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}

tick-history-rest-apijava
image002.png (29.2 KiB)
icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Upvote
28.8k 32 11 15

Hello @Vinod A ,

I do not reproduce this issue on my side, with the latest RTH Java example deck from dev portal RTH Downloads. I receive all my report templates back (which is a lot).

Are you using the latest example from dev portal?

Are all the previous steps in the example working as expected on your side, and you are are able to create template, get template, delete template?

If yes, let me just guess here, do you have a tremendous number of report templates created under your user, and have you waited long enough?

If this could be the case, can you step-by-step through the code in your IDE, and see if its lingering in:

HttpResponse response = httpclient.execute(request);

If this is the case, I would test the same request from Postman, see how long it takes, and wait that time in Java, plus a add some extra time, for the overhead.

Let us know what you learn on your side?

icon clock
10 |1500

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.