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

Overview |  Quickstart |  Documentation |  Downloads |  Tutorials

question

Upvotes
Accepted
1 1 2 0

How can we create tXML PriceHistory Report using Java API Rest on DSS?

Specifically, how can we create the part of the XML PriceHistory Report indicated in bold using Java API Rest?


<NumericDataField>

<Name>Open Price</Name>

<FieldNumber>5</FieldNumber>

<DataFieldType>Numeric</DataFieldType>

<Justification>Left</Justification>

<Width>18</Width>

<WidthStyle>Variable</WidthStyle>

<DecimalPlaces>5</DecimalPlaces>

<DecimalSeparator>Period</DecimalSeparator>

<IntegerPlaces>12</IntegerPlaces>

<LeadingZeroes>No</LeadingZeroes>

<TrailingZeroes>No</TrailingZeroes>

<ThousandSeparator>No</ThousandSeparator>

<ThousandCharacter>Comma</ThousandCharacter>

<NegativePosition>Before</NegativePosition>

</NumericDataField>

<NumericDataField>

<Name>High Price</Name>

<FieldNumber>6</FieldNumber>

<DataFieldType>Numeric</DataFieldType>

<Justification>Left</Justification>

<Width>18</Width>

<WidthStyle>Variable</WidthStyle>

<DecimalPlaces>5</DecimalPlaces>

<DecimalSeparator>Period</DecimalSeparator>

<IntegerPlaces>12</IntegerPlaces>

<LeadingZeroes>No</LeadingZeroes>

<TrailingZeroes>No</TrailingZeroes>

<ThousandSeparator>No</ThousandSeparator>

<ThousandCharacter>Comma</ThousandCharacter>

<NegativePosition>Before</NegativePosition>

</NumericDataField>



Below you can see a first attempt to create the Pricing Report attached.



/**

* Create a PriceHistory Report Template

*

*@paramreportTemplateName

*@returnreportTemplateId

*/

publicString createPHReportTemplate(StringreportTemplateName) {


StringreportTemplateId="";


try{

HttpPosthttppost=newHttpPost(urlHost+"/Extractions/PriceHistoryReportTemplates");


httppost.addHeader("content-type","application/json;odata.metadata=minimal");

httppost.addHeader("Authorization","Token "+sessionToken);


// Note: content fields are specific to each report template type

JSONOrderedObjectTAndCTemplateJSONObject=newJSONOrderedObject()

.put("@odata.type","#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.PriceHistoryReportTemplate")

.put("Name",reportTemplateName)

.put("ShowColumnHeaders",true)

.put("CompressionType","None")

.put("Headers",newJSONArray() )

.put("OutputFormat","CommaSeparatedValues")

.put("Delimiter","None")

.put("DeliveryType","None")

.put("Trailers",newJSONArray() )

.put("ContentFields",newJSONArray()

.put(newJSONObject()

.put("FieldName","Trade Date")

.put("Format","ContentFieldDateFormat")

.put("DateFormat","yyyyMMdd")

.put("Justification","Left")


@vinod.amarnath

dss-rest-apidatascope-selectdss
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.

12 Answers

Upvotes
Accepted
23k 22 9 14

Hello @c.ciurlo,

Do not think you will be able to proceed the way you discuss, if I correctly understood what you are looking to do.

Please see InstrumentListDeleteItemsById in API Reference Tree spec and the summary on the parameters. This call is parametrized with instrument keys, not instrument RICs.

Would suggest:

  1. To first use GetAllInstruments in API Reference Tree call to obtain the instrument keys that you required
  2. To call DeleteItemsById and pass keys of the instruments obtained in step 1 that you require to delete.

Is this, however, what you are looking to do?

An alternative, if the list is dynamic, is to delete the list as per .Net SDK Tutorial 2: GUI control calls: List, report, sched and to re-recreate it with the required instruments, many prefer this approach.

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.

Question.txtHi @zoya.farberov, Thank you for all your help. Could you please confirm on the below:

@c.ciurlo added the code to verify; provided in file attached. Can you check if it’s correct? Maybe they have found a way to delete an instrument from a list.


question.txt (5.6 KiB)

Hello @vinod.amarnath and @c.ciurlo,

The code appears to be implemented as suggested.

But do you observe it working as expected, or is there an issue that you observe when you run it?

Hi @zoya.farberov, the code I posted you appears to work as expected.

Thank you.

Upvotes
23k 22 9 14

Hello @vinod.amarnath,

As I tried submitting the same request, I have found two stoppers,

  • "LeadingZeros" does not appear to be a valid field, according to spec. Is likely "UseLeadingZero". Please see REST API Spec for all valid Format fields.
  • JSONArray introduces extraneous escape characters into serialized request string, and that causes resulting submitted string to be rejected as invalid.

My solution to this last issue is not the most elegant, rather a quick, brute-force replaces of all unneeded characters:

      try {    
            
            HttpPost httppost = new HttpPost(urlHost + "/Extractions/PriceHistoryReportTemplates"); 
            
            httppost.addHeader("content-type", "application/json;odata.metadata=minimal");  
            httppost.addHeader("Authorization", "Token "+sessionToken);
            
            JSONOrderedObject reportTemplateJSONObject = new JSONOrderedObject();
            reportTemplateJSONObject.put( "@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.PriceHistoryReportTemplate");
            reportTemplateJSONObject.put("ShowColumnHeaders",false);
            reportTemplateJSONObject.put("Name", reportTemplateName);
            
            JSONArray headersArray = new JSONArray();
            reportTemplateJSONObject.put("Headers", headersArray);
            JSONArray trailersArray = new JSONArray();
            reportTemplateJSONObject.put("Trailers", trailersArray);
            
         // ContentFields: Add fields
            JSONArray contentFieldNamesArray = new JSONArray();    
            
            JSONObject cfJSONObject = new JSONObject();
            cfJSONObject.put("FieldName", "RIC");           
            cfJSONObject.put( "Format", JSONObject.NULL);                     
            contentFieldNamesArray.put(cfJSONObject);
            
                        
            JSONObject cfJSONObject2 = new JSONObject();
            cfJSONObject2.put("FieldName", "Open Price");
            
            JSONOrderedObject ftJSONObject = new JSONOrderedObject();
            ftJSONObject.put( "@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldNumberFormat");
            ftJSONObject.put( "DecimalPlaces", 5 );    
            ftJSONObject.put( "DecimalSeparator", "Period" );    
            ftJSONObject.put( "UseLeadingZero" , true );    
            
            cfJSONObject2.put( "Format", ftJSONObject);
            contentFieldNamesArray.put(cfJSONObject2); 
            reportTemplateJSONObject.put("ContentFields", contentFieldNamesArray);
            
            JSONOrderedObject conditionJSONObject = new JSONOrderedObject();
            conditionJSONObject.put( "QueryStartDate", "2015-10-28T00:00:00.000Z" );    
            conditionJSONObject.put( "QueryEndDate", "2015-11-04T00:00:00.000Z" );
            conditionJSONObject.put( "AdjustedPrices", false );    
            reportTemplateJSONObject.put("Condition", conditionJSONObject);
                        
            System.out.println("JSON request: "+ reportTemplateJSONObject.toString(2));
            System.out.println("JSON request: "+ reportTemplateJSONObject.toString(2).replaceAll("\\\\", "").replace("\"{","{").replace("}\"","}"));
            StringEntity params =new StringEntity(reportTemplateJSONObject.toString().replaceAll("\\\\", "").replace("\"{","{").replace("}\"","}"));
            
            httppost.setEntity(params);
  
            ResponseHandler<String> responseHandler=new BasicResponseHandler();
    
            String strResponse = httpclient.execute(httppost, responseHandler);
            JSONObject jsonResponse=new JSONObject(strResponse);
            
            StringWriter out = new StringWriter();
            jsonResponse.write(out);    
            System.out.println("JSON response: "+ out
           
        } catch (JSONException e) {
                

I hope this helps?




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 1 2 0

Hello @zoya.farberov

Thank you for this. Could you also assist on the below:

How can we specify the “FieldNumber” field of XML via Java API code?


<Body>

<DateDataField>

<Name>Trade Date</Name>

<FieldNumber>0</FieldNumber>

<DataFieldType>Date</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<DateFormat>yyyyMMdd</DateFormat>

</DateDataField>

<TextDataField>

<Name>File Code</Name>

<FieldNumber>1</FieldNumber>

<DataFieldType>Text</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<Capitalization>None</Capitalization>

</TextDataField>


Is the order of the fields automatically generated based on the order in which the JSONObjects are inserted into the JSONArray?

Thanks you.

Best regards,


Cosimo



.put("ContentFields",newJSONArray()

.put(newJSONObject()

.put("FieldName","Trade Date")

.put("Format",newJSONOrderedObject()

.put("@odata.type","#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldDateFormat")

.put("DateFormat","yyyyMMdd"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put(newJSONObject()

.put("FieldName","File Code")

.put("Format",newJSONOrderedObject()

.put("@odata.type","#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put(newJSONObject()

.put("FieldName","RIC")

.put("Format",newJSONOrderedObject()

.put("@odata.type","#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put(newJSONObject()

.put("FieldName","ISIN")

.put("Format",newJSONOrderedObject()

.put("@odata.type","#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))




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
23k 22 9 14

Hello @vinod.amarnath,

Please see DSS Spec, I do not think it is defined per spec in the way that you use it?

Or do you mean "Number" = FieldNumber" that is only part of Headers and Trailers?

 JSONArray headersArray = new JSONArray();
            JSONObject headerfJSONObject = new JSONObject();
            headerfJSONObject.put("Number", 5);      
            headersArray.put(headerfJSONObject);
            
            reportTemplateJSONObject.put("Headers", headersArray);


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 1 2 0

Hi @zoya.farberov

with this code:

JSONOrderedObject PHTemplateJSONObject = new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.PriceHistoryReportTemplate")

.put("Name", reportTemplateName)

.put("ShowColumnHeaders", true)

.put("CompressionType", "None")

.put("Headers", new JSONArray() )

.put("OutputFormat", "CommaSeparatedValues")

.put("Delimiter", "None")

.put("DeliveryType", "None")

.put("Trailers", new JSONArray() )

.put("ContentFields", new JSONArray()

.put( new JSONObject()

.put("FieldName", "Trade Date")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldDateFormat")

.put("DateFormat","yyyyMMdd"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "File Code")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "RIC")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")


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 1 2 0

Hi @zoya.farberov, Please find below full API details:


with this code (A), the XML report template (B) is generated (downloaded directly from Datascope site):



A

JSONOrderedObject PHTemplateJSONObject = new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.PriceHistoryReportTemplate")

.put("Name", reportTemplateName)

.put("ShowColumnHeaders", true)

.put("CompressionType", "None")

.put("Headers", new JSONArray() )

.put("OutputFormat", "CommaSeparatedValues")

.put("Delimiter", "None")

.put("DeliveryType", "None")

.put("Trailers", new JSONArray() )

.put("ContentFields", new JSONArray()

.put( new JSONObject()

.put("FieldName", "Trade Date")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldDateFormat")

.put("DateFormat","yyyyMMdd"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "File Code")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "RIC")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "ISIN")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "Currency Code")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldTextFormat")

.put("Capitalization","None"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

)

.put( new JSONObject()

.put("FieldName", "Open Price")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldNumberFormat")

.put("DecimalPlaces",5)

.put("DecimalSeparator","Period")

.put("IntegerPlaces",12)

.put("UseLeadingZero",false) // LeadingZeroes No

.put("UseTrailingZero",false) // TrailingZeroes No

.put("UseThousandSeparator",false)

.put("ThousandSeparator","Comma")

.put("NegativeSignPosition","Before"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

.put("Width", 18)

)

.put( new JSONObject()

.put("FieldName", "High Price")

.put("Format", new JSONOrderedObject()

.put("@odata.type", "#ThomsonReuters.Dss.Api.Extractions.ReportTemplates.ContentFieldNumberFormat")

.put("DecimalPlaces",5)

.put("DecimalSeparator","Period")

.put("IntegerPlaces",12)

.put("UseLeadingZero",false) // LeadingZeroes No

.put("UseTrailingZero",false) // TrailingZeroes No

.put("UseThousandSeparator",false)

.put("ThousandSeparator","Comma")

.put("NegativeSignPosition","Before"))

.put("Justification","Left")

.put("WidthStyle","VariableWidth")

.put("Width", 18)

))


.put("Condition", new JSONOrderedObject()

.put("AdjustedPrices", false)

.put("LastEntityOnly", false)

.put("ReportDateRangeType", "Range")

.put("QueryStartDate","2018-10-10T00:00:00.000Z")

.put("QueryEndDate","2018-10-15T00:00:00.000Z"));


System.out.println("PriceHistory template creation JSON request content:\n"+ PHTemplateJSONObject.toString(2).replaceAll("\\\\", "").replace("\"{","{").replace("}\"","}"));

StringEntity requestBody = new StringEntity(PHTemplateJSONObject.toString().replaceAll("\\\\", "").replace("\"{","{").replace("}\"","}"));


httppost.setEntity(requestBody);


ResponseHandler<String> responseHandler = new BasicResponseHandler();


String response = httpclient.execute(httppost, responseHandler);








B


<?xml version="1.0" encoding="utf-8"?>

<ReportRequest xmlns="http://www.refinitiv.com/Datascope/ReportRequest.xsd">

<ReportTemplate version="2">

<ReportAction>Replace</ReportAction>

<Name>Demo_PriceHistory_Template</Name>

<TemplateType>PriceHistory</TemplateType>

<OutputFormat>CSV</OutputFormat>

<Delimiter>None</Delimiter>

<Delivery>None</Delivery>

<Compression>None</Compression>

<ColumnHeaders>Yes</ColumnHeaders>

<Conditions>

<BoolCondition>

<Name>AdjustedPrices</Name>

<Value>No</Value>

</BoolCondition>

<BoolCondition>

<Name>LastEntityOnly</Name>

<Value>No</Value>

</BoolCondition>

<DateCondition>

<Name>QueryEndDate</Name>

<Value>2018-10-15</Value>

</DateCondition>

<DateCondition>

<Name>QueryStartDate</Name>

<Value>2018-10-10</Value>

</DateCondition>

<SingleSelectionCondition>

<Name>ReportDateRangeType</Name>

<Value>Range</Value>

</SingleSelectionCondition>

</Conditions>

<Body>

<DateDataField>

<Name>Trade Date</Name>

<FieldNumber>0</FieldNumber>

<DataFieldType>Date</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<DateFormat>yyyyMMdd</DateFormat>

</DateDataField>

<TextDataField>

<Name>File Code</Name>

<FieldNumber>1</FieldNumber>

<DataFieldType>Text</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<Capitalization>None</Capitalization>

</TextDataField>

<TextDataField>

<Name>RIC</Name>

<FieldNumber>2</FieldNumber>

<DataFieldType>Text</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<Capitalization>None</Capitalization>

</TextDataField>

<TextDataField>

<Name>ISIN</Name>

<FieldNumber>3</FieldNumber>

<DataFieldType>Text</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<Capitalization>None</Capitalization>

</TextDataField>

<TextDataField>

<Name>Currency Code</Name>

<FieldNumber>4</FieldNumber>

<DataFieldType>Text</DataFieldType>

<Justification>Left</Justification>

<WidthStyle>Variable</WidthStyle>

<Capitalization>None</Capitalization>

</TextDataField>

<NumericDataField>

<Name>Open Price</Name>

<FieldNumber>5</FieldNumber>

<DataFieldType>Numeric</DataFieldType>

<Justification>Left</Justification>

<Width>18</Width>

<WidthStyle>Variable</WidthStyle>

<DecimalPlaces>5</DecimalPlaces>

<DecimalSeparator>Period</DecimalSeparator>

<IntegerPlaces>12</IntegerPlaces>

<LeadingZeroes>No</LeadingZeroes>

<TrailingZeroes>No</TrailingZeroes>

<ThousandSeparator>No</ThousandSeparator>

<ThousandCharacter>Comma</ThousandCharacter>

<NegativePosition>Before</NegativePosition>

</NumericDataField>

<NumericDataField>

<Name>High Price</Name>

<FieldNumber>6</FieldNumber>

<DataFieldType>Numeric</DataFieldType>

<Justification>Left</Justification>

<Width>18</Width>

<WidthStyle>Variable</WidthStyle>

<DecimalPlaces>5</DecimalPlaces>

<DecimalSeparator>Period</DecimalSeparator>

<IntegerPlaces>12</IntegerPlaces>

<LeadingZeroes>No</LeadingZeroes>

<TrailingZeroes>No</TrailingZeroes>

<ThousandSeparator>No</ThousandSeparator>

<ThousandCharacter>Comma</ThousandCharacter>

<NegativePosition>Before</NegativePosition>

</NumericDataField>

</Body>

</ReportTemplate>

</ReportRequest>



The “FieldNumber” field in this XML is not specified in the Java code. Is it generated automatically? Is it possible to specify this field in the Java code?

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
23k 22 9 14

Hello @vinod.amarnath,

I do not find this field in the current API Reference Tree -> ReportTemplate -> Create, please review.

Therefore, we will not be able to specify it. However, we can add fields into Template in Java code in any order, so it appears that you have a way of satisfying the requirement without explicitly specifying FieldNumber in code?

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
3 0 0 0
Hello zoya.farberov, It is important for us that the order of the fields in the report template is maintained (as it seems). Can you confirm that the implementation posted is correct? Or is it necessary to specify another parameter? We have another question: could you give us a Java example of how to delete instruments (one or more) from an Instruments List? Thanks again. Best regards
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
23k 22 9 14

Hello @c.ciurlo @vinod.amarnath,

To my best knowledge, yes.

(It is always better to ask a separate question as a new separate question- start a new thread- this way the question gets better visibility and in the future it is easier to find via search)

Try :

 public void removeField(String reportTemplateId, String fieldName) {
        try {
            HttpPost httppost = new HttpPost(urlHost + "/Extractions/ReportTemplates('"+reportTemplateId+"')/ThomsonReuters.Dss.Api.Extractions.ReportTemplateRemoveContentField"); 
              
              httppost.addHeader("content-type", "application/json;odata.metadata=minimal");  
              httppost.addHeader("Authorization", "Token "+sessionToken);
              
              JSONOrderedObject removeFieldJSONObject = new JSONOrderedObject();
              JSONOrderedObject fieldJSONObject = new JSONOrderedObject();
              fieldJSONObject.put("FieldName",fieldName);
              removeFieldJSONObject.put("ContentField",fieldJSONObject);

              System.out.println("Remove field "+fieldName+" from Report Template with this Id: "+ reportTemplateId);

              StringEntity params =new StringEntity(removeFieldJSONObject.toString());            
              httppost.setEntity(params);                                       
              System.out.println("httppost: "+removeFieldJSONObject.toString(2));

              HttpResponse response = httpclient.execute(httppost);

              System.out.println("Response Code : " 
                      + response.getStatusLine().getStatusCode());

              // it'd receive response code 204 with no content

              if (response.getStatusLine().getStatusCode() == 204){
                  System.out.println("Delete of field " + fieldName + " completed");
              } else {
                  System.out.println("Check error status: "+ response.getStatusLine().getStatusCode());
              }    
            
        } catch (ClientProtocolException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } 
    }



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
3 0 0 0
Hi zoya.farberov, We need to delete instruments (one or more) from an Instruments List, not a field from a Report Template. Thank you again. Best regards, Cosimo
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
3 0 0 0
Hi zoya.farberov, I'm trying with this code, but the instrument is not found (in the specified list is present). public void deleteInstrumentsFromList(String listId) { try { HttpPost httppost = new HttpPost(urlHost + "/Extractions/InstrumentLists('"+listId+"')/ThomsonReuters.Dss.Api.Extractions.InstrumentListDeleteItemsById"); httppost.addHeader("content-type", "application/json;odata.metadata=minimal"); httppost.addHeader("Authorization", "Token " + sessionToken); JSONOrderedObject instListJSONObject = new JSONOrderedObject() .put("InstrumentListItemKeys", new JSONArray() .put(" CARR.PA") ); System.out.println("Instrument addition JSON request content:\n"+ instListJSONObject.toString()); StringEntity requestBody = new StringEntity(instListJSONObject.toString()); //StringEntity requestBody = new StringEntity(""); httppost.setEntity(requestBody); ResponseHandler responseHandler = new BasicResponseHandler(); String response = httpclient.execute(httppost, responseHandler); JSONObject jsonResponse = new JSONObject(response); StringWriter out = new StringWriter(); jsonResponse.write(out); System.out.println("JSON response contents:\n"+ out); } catch (UnsupportedEncodingException e) { e.printStackTrace(); } catch (ClientProtocolException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
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
3 0 0 0

Hi @zoya.farberov, it appears to work as expected.

Thank you.

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