question

Upvotes
Accepted
76 5 3 7

while Retrieving schedule id with schedule name request getting stuck

Trying to get the schedule id from name but given request is getting stuck.please help

String urlGet = urlHost + "/Extractions/ScheduleGetByName(ScheduleName='" + ScheduleName + "')"; HttpGet request = new HttpGet(urlGet); request.addHeader("Authorization", "Token "+sessionToken);

System.out.println("Retrieve Schedule with this name: "+ ScheduleName); ---running till here

HttpResponse response = httpclient.execute(request); -- getting stuck at this point if given schedule is not availble

tick-history-rest-api
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.

Upvotes
Accepted
76 5 3 7
  • yes we are using proxy, one of user suggested to increase MaxConnPerRoute.it worked. Anayways Thank you for trying
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.

Thank you for the update. Glad to know that the issue is solved.

Upvotes
11.3k 25 8 14

Hi @samara,

I have tried the code, but cannot replicate the issue. If the schedule name is not available, the server will return HTTP 404 status with error message in payload. The application should handle the status.

Below is the code I use. Could you please try?

    String urlGet = urlHost + "/Extractions/ScheduleGetByName(ScheduleName='" + ScheduleName + "')"; 
    HttpGet request = new HttpGet(urlGet); 
    request.addHeader("Authorization", "Token "+sessionToken);

    System.out.println("Retrieve Schedule with this name: "+ ScheduleName);
    
    HttpResponse response = httpclient.execute(request);    

    System.out.println("Get ScheduleByName. 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("JSON results received:\n"+result);

Output:

Retrieve Schedule with this name: incorrect
Get ScheduleByName. HTTP status: 404

JSON results received:
{"error":{"message":"Exception of type 'ThomsonReuters.Dss.Core.Exceptions.NotFoundException`1[ThomsonReuters.Dss.Api.Extractions.Schedules.Schedule]' was thrown."}}
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.

even my code is working the thing is i have three similar requests to check instruments list , report and schedule because daily we create and drop the these because our requests are adhoc. daily we use the same name so to avoid failure we are checking first and then we are creating if first two returns 404 the third request is getting stuck

Is it possible that the issue is related to a specific schedule name? Could you try other schedule name which is also unavailable?

Tried still getting stuck. if first two returns 404 then third one getting stuck.if i submit third request alone it is working

Thanks for the information. I have tried to call InstrumentListGetByName, ReportTemplateGetByName and ScheduleGetByName subsequently and still get all 404 responses. Is your application behind proxy? Is it possible that the proxy block the 3rd 404 response?

To isolate the issue, could you change the sequence of the calls? For example, the 3rd call is on InstrumentListGetByName.