Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • 中文论坛 /
avatar image
REFINITIV
Question by Hao.Tang · Sep 08, 2021 at 07:52 AM · dss-rest-apidatascope-selectdss

DSS Rest API C#

客户使用我司提供的DSS Rest API C# example(附件),每日抓取一个数据文件,遇到两个问题:

1)客户已删除的文件还可以通过接口全部取到(已删除文件size=0)

2)客户只想获取数据文件,不想获取RIC list和Note

建议客户尝试了Get latest和Get Changes,都返回同样的结果,如附件两张snapshot

请帮忙检查哪个API参数需要变更,只获得最新的数据文件,多谢


#region Extracted Files


[Example("Get Latest")]

public void GetLatest()

{

/* This example provides an alternate mechanism for retrieving the extraction contents for a schedule or schedules.

* The preferred approach is to use the WaitForNextExtraction method on the toolkit (or LastExtraction association

* property). The MaxPageSize defaults to 250 and should be kept at the default. If the first page's results have

* the HasNextPage set to true then more data is available. You can continue to retrieve subsequent pages using

* GetAll and passing in the next link. When no more data is available, HasNextPage will be false. */

ExtractionsContext.Preferences.MaxPageSize = 3; //Only set for the purposes of the example


Status.Notify(ExtractionsContext, "ReportExtraction", "GetAll", MethodType.Operation, Publish.Primary);

//Returns the first page (250) of the latest Report Extractions for all Schedules.

var firstPage = ExtractionsContext.ReportExtractionOperations.GetAll();


//Output

//Use the schedule id to determine which schedule the results are associated to.

Status.WriteLine("FIRST PAGE:");

foreach (var reportExtraction in firstPage)

Status.WriteLine("ScheduleName: {0}, Date: {1}",

reportExtraction.ScheduleName, reportExtraction.ExtractionDateUtc);

Status.EndNotify(ExtractionsContext);


Status.Notify(ExtractionsContext, "ReportExtraction", "GetAll", MethodType.Operation, Publish.Secondary);

//Only get the second page of data if data is available.

if (firstPage.HasNextPage)

{

//Returns the second page. Notice that NextLink is passed to GetAll.

var secondPage = ExtractionsContext.ReportExtractionOperations.GetAll(firstPage.NextLink);


//Output

Status.WriteLine("SECOND PAGE:");

foreach (var reportExtraction in secondPage)

Status.WriteLine("ScheduleName: {0}, Date: {1}",

reportExtraction.ScheduleName, reportExtraction.ExtractionDateUtc);

}

Status.EndNotify(ExtractionsContext);


}


#endregion


#region Extracted Files


[Example("ExtractedFiles: Get Latest")]

public void ExtractedFilesGetLatest()

{

/* This example provides an alternate mechanism for retrieving the extraction contents for a schedule or schedules.

* The preferred approach is to use the WaitForNextExtraction method on the toolkit (or LastExtraction association

* property). The MaxPageSize defaults to 250 and should be kept at the default. If the first page's results have

* the HasNextPage set to true then more data is available. You can continue to retrieve subsequent pages using

* GetAll and passing in the next link. When no more data is available, HasNextPage will be false. */

ExtractionsContext.Preferences.MaxPageSize = 3; //Only set for the purposes of the example


Status.Notify(ExtractionsContext, "ExtractedFile", "GetAll", MethodType.Operation, Publish.Primary);

//Returns the first page (250) of the latest Extracted Files for all Report Extractions for all Schedules.

var firstPage = ExtractionsContext.ExtractedFileOperations.GetAll();


//Output

//Use the schedule id to determine which schedule the results are associated to.

Status.WriteLine("FIRST PAGE:");

foreach (var extractedFile in firstPage)

Status.WriteLine("ScheduleId: {0}, Filename: {1}, Size: {2}, ContentsExist: {3}",

extractedFile.ScheduleId, extractedFile.ExtractedFileName, extractedFile.Size, extractedFile.ContentsExists);

Status.EndNotify(ExtractionsContext);


Status.Notify(ExtractionsContext, "ExtractedFile", "GetAll", MethodType.Operation, Publish.Secondary);

//Only get the second page of data if data is available.

if (firstPage.HasNextPage)

{

//Returns the second page of Extracted Files. Notice that NextLink is passed to GetAll.

var secondPage = ExtractionsContext.ExtractedFileOperations.GetAll(firstPage.NextLink);


//Output

//Use the schedule id to determine which schedule the results are associated to.

Status.WriteLine("SECOND PAGE:");

foreach (var extractedFile in secondPage)

Status.WriteLine("ScheduleId: {0}, Filename: {1}, Size: {2}, ContentsExist: {3}",

extractedFile.ScheduleId, extractedFile.ExtractedFileName, extractedFile.Size, extractedFile.ContentsExists);

}

Status.EndNotify(ExtractionsContext);


}


[Example("ExtractedFiles: Get Changes")]

public void ExtractedFilesGetChanges()

{

/* This example provides an alternate mechanism for retrieving the extraction contents for a schedule or schedules.

* The preferred approach is to use the WaitForNextExtraction method on the toolkit (or LastExtraction association

* property).

* If Change Tracking is enabled the server returns a delta token along with the payload. If the delta token is

* presented on a subsequent request only records that have changed since the prior request are returned.

* NOTE: Paging is in effect along with change tracking. */

ExtractionsContext.Preferences.MaxPageSize = 3; //Only set for the purposes of the example

ExtractionsContext.Preferences.TrackChanges = true; //Let the API know that you are interested in tracking changes.


Status.Notify(ExtractionsContext, "ExtractedFile", "GetAll", MethodType.Operation, Publish.Secondary);

//Get all the results. The results are paged so that a maximum of 250 are returned. Because TrackChanges was set to

//true, firstPage.DeltaLink includes a token that can be used to find any changes that were made since this request.

//If you _really_ wanted all the results here you would have to call GetAll with all.NextLink until HasNextPage is

//false.

var all = ExtractionsContext.ExtractedFileOperations.GetAll();


//Output

Status.WriteLine("ALL:");

//NOTE: DeltaLink's can be persisted using DeltaLink.ToString() and DeltaLink.Parse().

Status.WriteLine("DeltaLink: " + all.DeltaLink.Url);

foreach (var extractedFile in all)

Status.WriteLine("ScheduleId: {0}, Filename: {1}, Size: {2}, ContentsExist: {3}",

extractedFile.ScheduleId, extractedFile.ExtractedFileName, extractedFile.Size, extractedFile.ContentsExists);

Status.EndNotify(ExtractionsContext);


Status.Notify(ExtractionsContext, "ExtractedFile", "GetAll", MethodType.Operation, Publish.Secondary);

//Get all the ExtractedFiles that have changed since the original request. Note that these results can also be paged

//which means that you would need to call GetAll with changed.NextLink while changed.HasNextPage is true.

var changed = ExtractionsContext.ExtractedFileOperations.GetAll(all.DeltaLink);


//Output

Status.WriteLine("CHANGES:");

//In this example there will be no changes since no extractions were likely to have run between these two calls to

//GetAll.

foreach (var extractedFile in changed)

Status.WriteLine("ScheduleId: {0}, Filename: {1}, Size: {2}, ContentsExist: {3}",

extractedFile.ScheduleId, extractedFile.ExtractedFileName, extractedFile.Size, extractedFile.ContentsExists);

Status.EndNotify(ExtractionsContext);


}


#endregion


People who like this

0 Show 0
Comment
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

2 Replies

  • Sort: 
avatar image
REFINITIV
Best Answer
Answer by bing.sun1 · Sep 08, 2021 at 10:55 AM

Hi @Hao.Tang , 据我所知,当前的设计就是这样的,可以通过 ContentsExists filter 掉已经删除的文件,通过FileType filter掉Notes和Ric file, 类似这样:

var all = ExtractionsContext.ExtractedFileOperations.GetAll();
var extractedFiles = all.Where(o => o.ContentsExists &&
                                    o.FileType != ExtractedFileType.Note &&
                   o.FileType != ExtractedFileType.RicMaintenanceNote).ToList();
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

avatar image
REFINITIV
Answer by Hao.Tang · Sep 08, 2021 at 07:54 AM

客户截图

1068854642.jpg1328196273.jpg


1068854642.jpg (115.6 KiB)
1328196273.jpg (167.5 KiB)
Comment

People who like this

0 Show 0 · Share
10 |1500 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

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

Watch this question

Add to watch list
Add to your watch list to receive emailed updates for this question. Too many emails? Change your settings >
8 People are following this question.

Related Questions

如何通过DSS C# API 获取指数的成分股信息(Index Constituents)

通过DSS Rest API 获取Corporate Actions 数据的时候如何添加过滤条件

  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Electronic Trading
    • Generic FIX
    • Local Bank Node API
    • Trading API
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Intelligent Tagging
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open Calais
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • RDMS
  • Refinitiv Data Platform
    • Refinitiv Data Platform Libraries
  • Rose's Space
  • Screening
    • Qual-ID API
    • Screening Deployed
    • Screening Online
    • World-Check One
    • World-Check One Zero Footprint
  • Side by Side Integration API
  • TR Knowledge Graph
  • TREP APIs
    • CAT
    • DACS Station
    • Open DACS
    • RFA
    • UPA
  • TREP Infrastructure
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • Workspace SDK
    • Element Framework
    • Grid
  • World-Check Data File
  • 中文论坛
  • Explore
  • Tags
  • Questions
  • Badges