Search by File Code in FuturesAndOptionsSearch
Hi,
I want to use the FuturesAndOptionsSearch to get all RICs within a FileCode without creating Instrument Usage on my DSS ID. Can I search by FIle Code with the API and if yes will my results be limited/truncated to 5000 lines? If the results will be limited, is there a workaround to request batches of 5000 results one after the other?
I have tried to post the following, obviously without success:
Request:
{
"SearchRequest": {
"FileCodes": "7155",
"CurrencyCodes": null,
"ExchangeCodes": null,
"IdentifierType": null,
"Identifier": null,
"PreferredIdentifierType": "Ric"
}
}
Respose:
{
"error": {
"message": "Malformed request payload: Invalid cast exception for property FileCodes: Unable to cast object of type 'System.String' to type 'System.Collections.Generic.List`1[System.String]'."
}
}
Thanks in advance any comments.
Greg
Best Answer
-
FileCodes property is an array of string, not a string. Therefore, the request must looks like:
{
"SearchRequest":{
"FileCodes":[
"7155"
],
"CurrencyCodes":null,
"ExchangeCodes":null,
"IdentifierType":null,
"Identifier":null,
"PreferredIdentifierType":"Ric"
}
}The number of results is limited by maxpagesize. The default maxpagesize is 250.
If there is a next page, the last property in the response will be "@odata.nextlink" field.
{
"Identifier": "UNGB231802400.U",
...
}
],
"@odata.nextlink": "https://hosted.datascopeapi.reuters.com/RestApi/v1/Search/FuturesAndOptionsSearch?$skiptoken='MjUw'"To get the next page, you need to use another POST request with the URL in "@odata.nextlink" field with the same SearchRequest in the payload.
However, you can change the number of entries returned in the response by specifying odata.maxpagesize in the Prefer header.
Prefer: odata.maxpagesize=500; respond-async
For more information regarding maxpagesize, please refer to this question
0
Answers
-
Hello
You need to add "[" and "]" around the value of "FileCodes" because its type is
IEnumerable<string> like the list of multiple strings as shown below:
{
"SearchRequest": {
"FileCodes": [
"7155"
],
"CurrencyCodes": null,
"ExchangeCodes": null,
"IdentifierType": null,
"Identifier": null,
"PreferredIdentifierType": "Ric"
}
}The example result:
{
"@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#Collection(ThomsonReuters.Dss.Api.Content.ValidatedInstrument)",
"value": [
{
"Identifier": "TRGPA181904500.U",
"IdentifierType": "Ric",
"Source": "OPQ",
"Key": "VjF8MHgwMDEwMGIwMDEyZTBlOWM0fDB4MDAxMDBiMDAxMmUwZTg1YXxPUFF8RFZRVXxPUFR8fER8fFRSR1BBMTgxOTA0NTAwLlV8NzE1NQ",
"Description": "TRGP Jan9 45.0 C",
"InstrumentType": "DerivativeQuote",
"Status": "Valid"
},
...
],
"@odata.nextlink": "https://hosted.datascopeapi.reuters.com/RestApi/v1/Search/FuturesAndOptionsSearch?$skiptoken='MjUw'"
}You can find out each parameter's type and the example http request(JSON Model) in API Reference Tree of FuturesAndOptionsSearch
For the API, please refer to
0 -
Thank You! Works perfectly. One additional question is what maximum number can I specify in the parameter odata.maxpagesize=??? I have tried even with 100000 and it works. Did I get lucky or will such requests always work? I noticed it took quite long.
0 -
@Gregor, I don't know if there is a max number for odata.maxpagesize, but please note the following from the help page on server driven paging:
Server-driven paging ensures that the quantity of data that is returned by a URI does not overwhelm DataScope Select REST API servers or the user agent application.
[...]
The DataScope Select REST API conforms to OData server driven paging specifications.
[...]
The page size default is 250 records for endpoints that support paging. This value can be customized although the DataScope REST API is not required to honor the requested page size. You should always code the user agent to account for the nextlink.
In other words: we recommend:
- To avoid setting large values for odata.maxpagesize. Setting a very large value will slow things down, as you noticed.
- That client code accounts for the nextlink. This will avoid errors.
0
Categories
- All Categories
- 3 Polls
- 6 AHS
- 36 Alpha
- 166 App Studio
- 6 Block Chain
- 4 Bot Platform
- 18 Connected Risk APIs
- 47 Data Fusion
- 34 Data Model Discovery
- 685 Datastream
- 1.4K DSS
- 616 Eikon COM
- 5.2K Eikon Data APIs
- 10 Electronic Trading
- Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 252 ETA
- 556 WebSocket API
- 38 FX Venues
- 14 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 23 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 275 Open PermID
- 44 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 22 RDMS
- 1.9K Refinitiv Data Platform
- 652 Refinitiv Data Platform Libraries
- 4 LSEG Due Diligence
- LSEG Due Diligence Portal API
- 4 Refinitiv Due Dilligence Centre
- Rose's Space
- 1.2K Screening
- 18 Qual-ID API
- 13 Screening Deployed
- 23 Screening Online
- 12 World-Check Customer Risk Screener
- 1K World-Check One
- 46 World-Check One Zero Footprint
- 45 Side by Side Integration API
- 2 Test Space
- 3 Thomson One Smart
- 10 TR Knowledge Graph
- 151 Transactions
- 143 REDI API
- 1.8K TREP APIs
- 4 CAT
- 27 DACS Station
- 121 Open DACS
- 1.1K RFA
- 104 UPA
- 193 TREP Infrastructure
- 228 TRKD
- 917 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 90 Workspace SDK
- 11 Element Framework
- 5 Grid
- 18 World-Check Data File
- 1 Yield Book Analytics
- 46 中文论坛