For a deeper look into our DataScope Select SOAP API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
4 0 1 3

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?

dss-rest-apidatascope-selectdss
icon clock
10 |1500

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

I should add that the fact that I need to look for completions to any of my scheduled requests means that I don't want to have to pass the Shedule object in to the query! Rather I'd like to know if any of my requests have competed so that I can retrieve the data.

Thanks

1 Answer

Upvote
Accepted
13.7k 26 8 12

@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".

icon clock
10 |1500

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

Thanks that helps

I'm trying to get data from the files which are returned, but can't link the reply with my request.

In the REST API I ExtractWithNotes(IntradayExtractionRequest) method I was able to link the request to the reply

For scheduled requests, I am forced to use file responses and, in the File base reply I do not seem to be able to determine what the identifier is for each row in the reply, nor what fields the comma separated data is for.

Is there an memberin the ReportExtraction object that will allow me to establish the relationship of the reply to my earlier data request?

@stephen.rabagliati

The ReportExtraction (and the extracted data file) contain the scheduleId as member. Does that help ?

To determine the identifier for each row, include the "Instrument ID" field in the list of requested field names. Personally I also like to add the "Instrument ID Type" field as well.

Additionally, there are user defined identifier fields that you can set per row on the input list and then request on your extraction rows. You can use them in whatever way helps you coordinated your results back to your request.

Then for the column headers, you can set ShowColumnHeaders = true when you define or edit a ReportTemplate. This will get you an extra row at the start of the file that has the field names of each column.

Thanks. The user defined identifiers sound like they might help. Do these have a special format?

I will explore the ShowColumnHeaders option..

Show more comments

There are User Defined Identifiers you can use on your Identifier input lists that you can set to tracking value you desire. Then, the original input identifier and each of these extra fields are selectable as output columns in your extraction results. That is intended to provide many linking options for the file based results.

I found that the

var results = ExtractionsContext.ScheduleOperations.GetAll()

call was most helpful. With that I was able to collect the data for all requests that the logged in user had made. Thank you

Thank you for your feedback, I'm glad you found a good solution to your use case.

Click below to post an Idea Post Idea