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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
11 4 4 5

create a user defined template

I want to create a use defined ElektronTimeseriesReportTemplate using REST API,

to change the format for a specific field: Settlement Price

but failed because of ("DecimalPlaces", 9), ("DecimalSeparator", "Period"),("IntegerPlaces", 25)

java code like below:

HttpPost httppost = new HttpPost(urlHost + "/Extractions/ElektronTimeseriesReportTemplates"); 
            httppost.addHeader("content-type", "application/json;odata.metadata=minimal");
            httppost.addHeader("Authorization", "Token " + sessionToken);
             // Note: content fields are specific to each report template type
            JSONOrderedObject reportTemplateJSONObject = new JSONOrderedObject()
                .put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ElektronTimeseriesReportTemplate")
                .put("ShowColumnHeaders", true)
                .put("CompressionType", "GZip")
                .put("Name", reportTemplateName )
                .put("Headers", new JSONArray() )
                .put("Trailers", new JSONArray() )
                .put("ContentFields", new JSONArray()
                .put( new JSONObject()
                            .put("FieldName", "Settlement Price")
                            .put("Label", "")
                            .put("Justification", "Center")
                            .put("WidthStyle", "VariableWidth")
                            .put("Format", new JSONObject()
                            .put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldNumberFormat")

                            .put("DecimalPlaces", 9)
                            .put("DecimalSeparator", "Period")
                            .put("IntegerPlaces", 25)
                            .put("UseLeadingZero", false)
                            .put("NegativeSignPosition", "Before")
                            .put("UseThousandSeparator", false)
                            .put("UseTrailingZero", false)
                            ))

                )
                .put("Condition", new JSONOrderedObject()
                        .put( "StartDate", StartDate + "T00:00:00.000-00:00" )
                        .put( "EndDate", EndDate + "T00:00:00.000-00:00" ));
dss-rest-apidatascope-selectdssrest-api
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.

1 Answer

Upvotes
Accepted
11.3k 25 8 13

I think this is related to the order of json object. Currently, the "@odata.type" has to be first element in the object, otherwise some properties will be failed to be loaded. Please change the JSONObject() to JSONOrderedObject() to prevent this issue.

.put( new JSONOrderedObject()
    .put("FieldName", "Settlement Price")
    .put("Label", "")
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