For a deeper look into our DataScope Select REST API, look into:

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 2 1

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



dss-rest-apidatascope-selectdss
icon clock
10 |1500

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

Hello @zohan.sim1

Thank you for your participation in the forum. Is the reply below satisfactory in resolving your query?

If yes, please click the 'Accept' text next to the reply. This will guide all community members who have a similar question. Otherwise please post again offering further insight into your question.

Thanks,

AHS

Please be informed that a reply has been verified as correct in answering the question, and has been marked as such.

Thanks,


AHS


Upvotes
Accepted
32.2k 40 11 20

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?

icon clock
10 |1500

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

Upvotes
32.2k 40 11 20

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

icon clock
10 |1500

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

Upvotes
1 0 2 1

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

icon clock
10 |1500

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

Upvotes
1 0 2 1

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);

}

}

icon clock
10 |1500

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

Upvotes
32.2k 40 11 20

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.


icon clock
10 |1500

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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