DSS EndOfDayPricingExtractionRequest json serialization

Hi there,
Iam calling DSS api, but can I serialize EndOfDayPricingExtractionRequest object to odata json before sending using HTTPClient ?
e.g. equivalent of calling this code but in HTTPclient
EndOfDayPricingExtractionRequest extractionEod = new EndOfDayPricingExtractionRequest
{
IdentifierList = InstrumentIdentifierList.Create(instrumentIdentifiers),
ContentFieldNames = tickerFields.ToArray()
};
extractionsContext.ExtractWithNotes(extractionEod);
I want to serialize extractionEod to this format below:
{""ExtractionRequest"": {
""@odata.type"": ""#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.EndOfDayPricingExtractionRequest"",
""ContentFieldNames"": [
""Exchange Code"",
""High Price"",
""Low Price"",
""Official Close Price"",
""Open Price"",
""Trade Date"",
""Volume""
],
""IdentifierList"": {
""@odata.type"": ""#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList"",
""InstrumentIdentifiers"": [{
""Identifier"": ""438516AC0"",
""IdentifierType"": ""Cusip""
},{
""Identifier"": ""IBM.N"",
""IdentifierType"": ""Ric""
}],
""ValidationOptions"": null,
""UseUserPreferencesForValidationOptions"": false
},
""Condition"": null
}
}";
If you got tutorial doc, please point that to me as well. That will be great
Thanks
Zohan
Best Answer
-
Hello @zohan.sim1,
Let me try to both explain a little about how the content is sent and make a suggestion?
Json content, for example taw EOD request:
{
"ExtractionRequest": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.EndOfDayPricingExtractionRequest",
"ContentFieldNames": [
"Ask Price",
"Asset Category",
"Asset Category Description",
"Asset ID",
...
"Valoren",
"Volume",
"VWAP Price",
"Wertpapier"
],
"IdentifierList": {
"@odata.type": "#ThomsonReuters.Dss.Api.Extractions.ExtractionRequests.InstrumentIdentifierList",
"InstrumentIdentifiers": [
{ "Identifier": "438516AC0", "IdentifierType": "Cusip" },
{ "Identifier": "IBM.N", "IdentifierType": "Ric" },
{ "Identifier": "0#US30YT=TWEB", "IdentifierType": "ChainRIC" }
]
},
"Condition": null
}
}is sent directly over HTTP directly. However, not right away. Two steps are required:
1. Authentication request has to happen, using valid login and password we obtain aobtain a valid authentication token. This step is described nicely in tutorial
https://developers.refinitiv.com/en/api-catalog/datascope-select/datascope-select-rest-api/tutorials
"REST API Tutorial 1: Connecting to the DSS server"
2. EndOfDay extraction request can happen, the json request will be sent over HTTP directly, but it's necessary to also submit a valid authentication token that is obtained in step 1, it will go in header. This is described in tutorial
"REST API Tutorial 2: On Demand End of Day Extraction"
I would like to suggest using a tool named Postman. It's free, quick and convenient to use, and allows to submit "naked" HTTP REST request and receive and examine the result.
https://developers.refinitiv.com/en/api-catalog/datascope-select/datascope-select-rest-api/tutorials
"REST API Tutorials Introduction" tutorial discuss how to start using Postman.
Command line curl utility does about the same, it helps to see the direct and "naked" interaction in action, but Postman makes it very easy and visual, whereas curl is command line, both would work for this purpose.
Let us know if this helps?
0
Answers
-
Hello @zohan.sim1,
You did not mention if you are using DSS .NET SDK to access. If you are please review .Net SDK Tutorial 5: On Demand: EoD extraction for an example of EOD request creation and submission.
Hope this helps you
0 -
Hi there,
Yes, we do use DSS .NET SDK.
Part of our upgrade to Net CORE, we are looking to call DSS REST API directly without using SDK.
In order to do that, I would like to find out how to serialise and deserialise EndOfDayPricingExtractionRequest object serialised to and from json message, before and after sending it to DSS REST API, and I can't seem finding the code from your SDK example there.
Could you please help? or even cut and paste the code here will be helpful
Thanks
Zohan
0 -
Thank you very much on the explanation. However, I would like simply to serialise EndOfDayPricingExtractionRequest object, instance of your SDK class below, to json request payload shown in your example above. Any sample code you can suggest? will JsonConvert.SerializeObject do the job?
namespace ThomsonReuters.Dss.Api.Extractions.ExtractionRequests
{
[TypeSerializer(typeof(EndOfDayPricingExtractionRequestJsonSerializer), "json")]
public class EndOfDayPricingExtractionRequest : ExtractionRequestBase
{
public EndOfDayPricingExtractionRequest();
[GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
public DssCollection<string> ContentFieldNames { get; set; }
[GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
public InstrumentIdentifierListBase IdentifierList { get; set; }
[GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
public EndOfDayPricingCondition Condition { get; set; }
[GeneratedCode("Microsoft.OData.Client.Design.T4", "1.0.0")]
public static EndOfDayPricingExtractionRequest Create(DssCollection<string> contentFieldNames, InstrumentIdentifierListBase identifierList, EndOfDayPricingCondition condition);
}
}
0 -
Hello @zohan.sim1,
In my understanding, yes, you can use any general, non-Refinitiv API specific approach to serialize object.
Alternatively, if you are looking for the json print out of C# SDK app, look DSS .Net Example Application and how it produces HTTP output, request and result that it displays:
Perhaps GetHttpRequestSnippet code can be of use to you, or perhaps other pieces of the example code can be usefully utilized toward your requirement.
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
- 690 Datastream
- 1.4K DSS
- 629 Eikon COM
- 5.2K Eikon Data APIs
- 11 Electronic Trading
- 1 Generic FIX
- 7 Local Bank Node API
- 3 Trading API
- 2.9K Elektron
- 1.4K EMA
- 255 ETA
- 559 WebSocket API
- 39 FX Venues
- 15 FX Market Data
- 1 FX Post Trade
- 1 FX Trading - Matching
- 12 FX Trading – RFQ Maker
- 5 Intelligent Tagging
- 2 Legal One
- 25 Messenger Bot
- 3 Messenger Side by Side
- 9 ONESOURCE
- 7 Indirect Tax
- 60 Open Calais
- 280 Open PermID
- 45 Entity Search
- 2 Org ID
- 1 PAM
- PAM - Logging
- 6 Product Insight
- Project Tracking
- ProView
- ProView Internal
- 23 RDMS
- 2K Refinitiv Data Platform
- 720 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
- 106 UPA
- 194 TREP Infrastructure
- 229 TRKD
- 918 TRTH
- 5 Velocity Analytics
- 9 Wealth Management Web Services
- 95 Workspace SDK
- 11 Element Framework
- 5 Grid
- 19 World-Check Data File
- 1 Yield Book Analytics
- 48 中文论坛