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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 0 0 1

DSS Rental Instrument Usage

I'm looking for a Rest Api call for DSS Rental Instrument Usage.

Is there any examples for C# or Java?

According to the following web page, "No C# Examples or HTTP Requests and Responses are available."

https://selectapi.datascope.refinitiv.com/RestApi.Help/Context/Operation?ctx=Usage&opn=GetExtractionUsageInstrumentSummary

Do you have any plans to implement this with the Rest Api?

Thanks

dss-rest-apijavac#usage
icon clock
10 |1500

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

Upvote
Accepted
38.1k 71 35 53

@hiroki.chinushi

To get instrument usage, You can use this endpoint (https://selectapi.datascope.refinitiv.com/RestApi/v1/Usage/GetExtractionUsageInstrumentSummar) with the HTTP Post method. The body of a request message contains:

{
    "ExtractionUsageCriteria": {
        "StartDateTime": "2021-01-01T00:00:00Z",
        "EndDateTime": "2021-11-01T00:00:00Z"
        
    }
}

The output is:

{
    "@odata.context": "https://selectapi.datascope.refinitiv.com/RestApi/v1/$metadata#DataScope.Select.Api.Usage.ExtractionUsageInstrumentSummaryResult",
    "Records": [
        {
            "AssetClass": "BMRK",
            "SubClass": "NONE",
            "ReportTemplate": "IDP",
            "SubTemplate": "NONE",
            "Count": 2,
            "EquityFairValue": 0,
            "FixedIncomeValuations": 0
        },
        {
            "AssetClass": "CHR",
            "SubClass": "NONE",
            "ReportTemplate": "THT",
            "SubTemplate": "NONE",
            "Count": 1695,
            "EquityFairValue": 0,
            "FixedIncomeValuations": 0
        },


1636528695162.png


The Java code generated by Postman is:

Unirest.setTimeouts(0, 0);
HttpResponse<String> response = Unirest.post("https://selectapi.datascope.refinitiv.com/RestApi/v1/Usage/GetExtractionUsageInstrumentSummary")
  .header("Prefer", "respond-async")
  .header("Content-Type", "application/json")
  .header("Authorization", "Token <token>")
  .body("{\r\n    \"ExtractionUsageCriteria\": {\r\n        \"StartDateTime\": \"2021-01-01T00:00:00Z\",\r\n        \"EndDateTime\": \"2021-11-01T00:00:00Z\"\r\n        \r\n    }\r\n}")
  .asString();

The C# code generated by Postman is:

var client = new RestClient("https://selectapi.datascope.refinitiv.com/RestApi/v1/Usage/GetExtractionUsageInstrumentSummary");
client.Timeout = -1;
var request = new RestRequest(Method.POST);
request.AddHeader("Prefer", "respond-async");
request.AddHeader("Content-Type", "application/json");
request.AddHeader("Authorization", "Token <token>");
var body = @"{
" + "\n" +
@"    ""ExtractionUsageCriteria"": {
" + "\n" +
@"        ""StartDateTime"": ""2021-01-01T00:00:00Z"",
" + "\n" +
@"        ""EndDateTime"": ""2021-11-01T00:00:00Z""
" + "\n" +
@"        
" + "\n" +
@"    }
" + "\n" +
@"}";
request.AddParameter("application/json", body,  ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
Console.WriteLine(response.Content);

The C# code with DSS .NET SDK is:

using DataScope.Select.Api.Usage;
...
Uri dssUri = new Uri("https://selectapi.datascope.refinitiv.com/RestApi/v1/");
var context = new UsageContext(dssUri, dssUserName.Value, dssPassword.Value);
var result = context.GetExtractionUsageInstrumentSummary(new ExtractionUsageInstrumentSummaryCriteria
{
    StartDateTime = DateTime.UtcNow - TimeSpan.FromDays(120),
    EndDateTime = DateTime.UtcNow
});
foreach(var rec in result.Records)
{
    Console.WriteLine($"AssetClass: {rec.AssetClass}");
    Console.WriteLine($"SubClass: {rec.SubClass}");
    Console.WriteLine($"ReportTemplate: {rec.ReportTemplate}");
    Console.WriteLine($"Count: {rec.Count}");
    Console.WriteLine($"EquityFairValue: {rec.EquityFairValue}");
    Console.WriteLine($"FixedIncomeValuations: {rec.FixedIncomeValuations}\n");
}



1636528695162.png (32.2 KiB)
icon clock
10 |1500

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

Upvotes
1 0 0 1

@Jirapongse

Thank you very much for your support.

I will do that.

icon clock
10 |1500

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

Click below to post an Idea Post Idea