Discover Refinitiv
MyRefinitiv Refinitiv Perspectives Careers
Created with Sketch.
All APIs Questions & Answers  Register |  Login
Ask a question
  • Questions
  • Tags
  • Badges
  • Unanswered
Search:
  • Home /
  • DSS /
avatar image
Question by Siarhei · Dec 14, 2017 at 01:50 PM · dsssearchc#search request

How to get all items from result of search request

Hi,

Could you please help me to get a collection of all ValidatedInstrument are returned by search request.

My code:

SearchContext.Preferences.MaxPageSize = null;
EquitySearchRequest request = EquitySearchRequest.Create(
	null, //Sub types
	null, //Asset categories
	null, //Company name
	null, //Currency codes
	null, //Description
	null, //Domiciles codes
	null, //Fair value indicator
	new[] { "NYS" }, //Exchange codes
	null, //GICs codes
	null, //File codes
	null, //Org identifier
	null, //Asset status
	null, //Ticker
	IdentifierType.Ric, //Identifier types
	null, //Identifier
	IdentifierType.Ric);
IDssEnumerable<ValidatedInstrument> results = SearchContext.EquitySearch(request);
var list = new List<ValidatedInstrument>();
list.AddRange(results); // adds 250 items
while (results.HasNextPage)
{
	results = SearchContext.EquitySearch(results.NextLink); // throws exception
	list.AddRange(results);
}

Exception details:

ThomsonReuters.Dss.Api.ValidationException was unhandled by user code
  Context=NullObjectSpace
  HResult=-2146233088
  Message=Value cannot be null.
ParameterName=SearchRequest
  Method=POST
  RequestCorrelationId=251d15f9-9f45-4ea9-9e59-20846da21109
  RetryCount=0
  ServerAppVersion=11.2.662.64
  Source=ThomsonReuters.Dss.RestApi.Client
  StatusCode=400
  Url=https://hosted.datascopeapi.reuters.com/RestApi/v1/Search/EquitySearch?$skiptoken='????'
  StackTrace:
       at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.<ParseResponseError>d__1b.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\HttpOData\Http\HttpClientExceptionDecorator.cs:line 284
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.<HandleExceptions>d__11.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\HttpOData\Http\HttpClientExceptionDecorator.cs:line 169
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpClientExceptionDecorator.<HandleExceptions>d__11.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\HttpOData\Http\HttpClientExceptionDecorator.cs:line 201
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.HttpOData.Http.HttpAsyncJobStrategy.<InvokeAsync>d__0.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\HttpOData\Http\HttpAsyncJobStrategy.cs:line 33
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.HttpOData.HttpODataClient.<InternalExecuteAsync>d__87.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\HttpOData\HttpODataClient.cs:line 552
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.HttpOData.HttpODataClient.<ExecuteAsync>d__7d`1.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\HttpOData\HttpODataClient.cs:line 525
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.OperationsBaseForHttpODataClient.<CallOnHttpODataClient>d__10b`1.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\OperationsBaseForHttpODataClient.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.Helper.<ReAuthenticateIfNecessaryAsync>d__6`1.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\Helper.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Api.Core.OperationsBaseForHttpODataClient.<ExecuteAsync>d__a0`1.MoveNext() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\OperationsBaseForHttpODataClient.cs:line 0
    --- End of stack trace from previous location where exception was thrown ---
       at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
       at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
       at ThomsonReuters.Dss.Core.RestApi.Threading.Tasks.AsyncHelper.RunSync[TResult](Func`1 func) in d:\BuildAgent\work\70c2df2f37febbb5\src\Core\Threading\Tasks\AsyncHelper.cs:line 25
       at ThomsonReuters.Dss.Api.Core.OperationsBase.InvokeSynchronously[T](Func`1 action) in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\OperationsBase.cs:line 397
       at ThomsonReuters.Dss.Api.DssDataServiceContext.<>c__DisplayClassf`1.<Execute>b__e() in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\DssDataServiceContext.cs:line 278
       at ThomsonReuters.Dss.Api.Core.Helper.ReAuthenticateIfNecessary[T](IDssDataServiceContext context, Func`1 method) in d:\BuildAgent\work\70c2df2f37febbb5\src\ServiceLayer\ServiceLayer.Client\Core\Helper.cs:line 40
       at ThomsonReuters.Dss.Api.Search.SearchContext.EquitySearch(ResourceLink`1 nextOrDeltaLink) in d:\BuildAgent\work\70c2df2f37febbb5\src\Api\RestApi.Client\SearchClientApi.generated.cs:line 423

I'm not sure that my code is correct, because it wtitten in different style as, for example, to collect instrument lists:

internal static List<InstrumentList> GetInstrumentLists(this ExtractionsContext context)
{
	var result = new List<InstrumentList>();
	var list = context.InstrumentListOperations.GetAll(); // get the first page of instrument lists (default page size is 250)
	do
	{
		result.AddRange(list);
		list = (list.HasNextPage ? context.InstrumentListOperations.GetAll(list.NextLink) : null); // goto next page in loop to retrieve all instrument lists
	}
	while (list != null);
	return result;
}

because I can't find any *Operations method in the SearchContext.

RestAPI client v.11.2.662.0.

Thanks!

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 warat.boonyanit · Jan 05, 2018 at 01:18 AM

The pagination isn’t working correctly with the EquitySearch endpoint.

The current behavior is that if you want to request the next page, you also need to include the original request body in the post request, or else you’ll get back a 400 error. However, even if you send the search request in the body, then the next page will return the original 250 instruments + the next 250 instruments, giving you duplicates if you’re storing each page.

The temporary workaround for this is to increase the max page size such that all instruments are returned within a single page.

This issue should be fixed in v12.

Comment
Siarhei

People who like this

1 Show 2 · 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
Siarhei · Jan 05, 2018 at 04:59 AM 0
Share

Thanks Warat! I already tested my code without use pagination and looks like it works fine when I set, for example:

SearchContext.Preferences.MaxPageSize = 100000;

I got over 87,000 instruments in some cases and it surpassed my expectations (50,000 returned in the DSS site GUI).

avatar image
REFINITIV
Christiaan Meihsl ♦♦ · Jun 05, 2018 at 09:37 AM 0
Share

Note: V12 was released on 23 April 2018.

avatar image
REFINITIV
Answer by veerapath.rungruengrayubkul · Dec 15, 2017 at 03:41 AM

Hi @Siarhei,

I have found the same exception. It seems that the EquitySearchRequest is required for requesting next page. However, I cannot find any interfaces to pass both EquitySearchRequest and nextLink parameters too.

Please contact DSS support team via the Raise A Case,selecting product "Reuters DataScope Select".

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 >
11 People are following this question.

Related Questions

Is there a way to limit the search results from the Datascope /Search/InstrumentSearch based on exchanges?

Instrument search conditions

Extract OnDemand in C# example always end up with no data

Datascope Select Search

Chain Ric Intraday Download Request: "all identifiers were invalid. No Extraction performed"

  • Feedback
  • Copyright
  • Cookie Policy
  • Privacy Statement
  • Terms of Use
  • Careers
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Alpha
  • App Studio
  • Block Chain
  • Bot Platform
  • Calais
  • Connected Risk APIs
  • DSS
  • Data Fusion
  • Data Model Discovery
  • Datastream
  • Eikon COM
  • Eikon Data APIs
  • Elektron
    • EMA
    • ETA
    • WebSocket API
  • Legal One
  • Messenger Bot
  • Messenger Side by Side
  • ONESOURCE
    • Indirect Tax
  • Open PermID
    • Entity Search
  • Org ID
  • PAM
    • PAM - Logging
  • ProView
  • ProView Internal
  • Product Insight
  • Project Tracking
  • 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
  • TRIT
  • TRKD
  • TRTH
  • Thomson One Smart
  • Transactions
    • REDI API
  • Velocity Analytics
  • Wealth Management Web Services
  • World-Check Data File
  • Explore
  • Tags
  • Questions
  • Badges