I have a report template (FXMain) with a daily schedule (FXDaily). I am looking to use Microsoft Flow to get the latest extract for the report.
In the API documentation, it makes it seem as though I have to jump through numerous hoops to get to that data. None of those hoops seem to rely on the basic information I already have - the name of the report and the name of the schedule.
Step 1 Authenticate
POST https:
//selectapi.datascope.refinitiv.com/RestApi/v1/Authentication/RequestToken HTTP/1.1
Prefer: respond-async
Content-Type: application/json; odata=minimalmetadata
{
"Credentials"
: {
"Username"
:
"<Your Username>"
,
"Password"
:
"<Your Password>"
}
}
I then analyze this to get a token
Step 2 Get list of Schedules
POST https:
//selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/Schedules HTTP/1.1
sort through that to find the schedule Id
Step 3:For a given schedule ID, find the extractions
GET https:
//selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/Schedules('0x05807049631b1f86')/LastExtraction HTTP/1.1
Authorization: Token <your_auth_token_goes_here>
Prefer: respond-async
dig through those results to find the report ID
Step 4: Download the report
GET https:
//selectapi.datascope.refinitiv.com/RestApi/v1/Extractions/ReportExtractions('6651450') HTTP/1.1
Authorization: Token <your_auth_token_goes_here>
Prefer: respond-async
Is this the correct procedure?
Is there nothing simpler that will just say "Download the data for the last extract of report FXMain in the FXDaily schedule"?
Hello @tzak,
For scheduled extraction approach:
1. You will need to authenticate once, per 24 hours. Within 24 hrs you can reuse the existent authentication token.
2. Once you have your scheduleID at hand (or stored in the app) you will not need to do this, you will use the schedule ID that you have.
3. You will need to lookup the last extraction's job ID. It is unique and will be required to obtain the result. I would also consider checking the status of the job to be completed, prior to downloading the result.
4. Downloading the result will need to be done.
This approach covers scheduled extractions, emulating processing via DSS GUI.
---
You may wish to review "on-demand" extraction approach, please see REST API Tutorial 3: On Demand data extraction workflow for more information. It is also asynchronous, and processing is separated into several steps, it may potentially align better with your use case/requirements.
---
These are the two available approaches.
I hope this information helps.
Your reply is lacking some details.
I am able to get the last extractionId, but when I run the /RestApi/v1/Extractions/ReportExtractions('MyExtractionId') command, it just gives me ome metadata about the extraction and it does not have a jobId in there. How can I get the actual file containing the data if I have an extraction Id?
Hello @tzak ,
Please see Tutorial: REST API Tutorial 12: GUI control calls: immediate extract, starting with section "Check Extraction Status" for the complete details on:
Is this information helpful?