Query DSS REST API for any scheduled request made by User

I am fairly new to using the DSS REST API and am looking for some guidance.

Using .Net C#, I am trying to to create (multiple) One Time scheduled requests for intraday prices. I want to create and schedule each request from and return control to my calling application.
I will have a separate thread to poll for any fulfilled requests, extracting and saving the response once received. I am looking for an API call that will allow me to test if any scheduled requests that I have made are complete, and then process the first of those messages. It is my intention that the receive thread will be able to retrieve any/all of the scheduled requests that might have been made in a separate instance of the application that requested them.

Does any suitable call exist for this purpose?

Best Answer

  • @stephen.rabagliati

    There are 2 issues here, let us treat them separately:

    How can your separate thread know about existing schedules ?

    When you create a schedule, a schedule ID is returned. You could pass that to your query.

    You can also retrieve a schedule by name (if you can pass the name):

    var schedule = ExtractionsContext.ScheduleOperations.GetByName(scheduleName);

    If you cannot pass anything, you could also retrieve a list of all scheduled operations, using:

    var results = ExtractionsContext.ScheduleOperations.GetAll();foreach (var schedule in results) Debug.WriteLine(schedule.Name);

    How can your separate thread check for the status of those schedules ?

    You can check for the last extraction:

    ExtractionsContext.LoadProperty(schedule, "LastExtraction");if (schedule.LastExtraction != null)
    {
    Debug.WriteLine("Schedule: {0}", schedule.LastExtraction.ScheduleName);
    Debug.WriteLine("Status: {0}", schedule.LastExtraction.Status); //Completed, Pending, Processing
    Debug.WriteLine("Detailed Status: {0}", schedule.LastExtraction.DetailedStatus);
    }

    You can also check for completed extractions:

    ExtractionsContext.LoadProperty(schedule, "CompletedExtractions");
    foreach (var extraction in schedule.CompletedExtractions)
    Debug.WriteLine("Extraction {0} status = {1}", extraction.ReportExtractionId, extraction.Status);

    These calls are illustrated in the C# example application (available in the DSS REST downloads). The Quick Start explains how to install and run the application. Run the application and look under section "Schedule Examples".

Answers