question

Upvotes
Accepted
64 3 5 7

how do I query a inactive RIC int Tickhistory V2

HI

I try to build some Java code to schedule a task to question some inactive RIC but it looks dow not work I got bad request error. this is my java code, any help?

protected JSONArray getRICJsonArray(List<String> ric) {
JSONArray ricList = new JSONArray();
ric.forEach(e ->
ricList.put(new JSONObject()
.put("@odata.type", "#ThomsonReuters.Dss.Api.Search.HistorcalSearchResult")
.put("Description", "Historical Instrument")
.put("Identifier", e)
.put("IdentifierType", "Ric")
.put("FirstDate", "2006-01-01T00:00:00.000Z")
.put("LastDate", LocalDate.now().toString() + "T23:59:59.000Z")
));
return ricList;
}

{"Identifiers":[{"LastDate":"2017-05-26T23:59:59.000Z","Description":"Historical Instrument","Identifier":"PETM.OQ","@odata.type":"#ThomsonReuters.Dss.Api.Search.HistorcalSearchResult","FirstDate":"2006-01-01T00:00:00.000Z","IdentifierType":"Ric"}],"KeepDuplicates":true}

if I replace JSONObject to JSONOrderObject I got

{"Identifiers":["{\"@odata.type\":\"#ThomsonReuters.Dss.Api.Search.HistorcalSearchResult\",\"Description\":\"Historical Instrument\",\"Identifier\":\"PETM.OQ\",\"IdentifierType\":\"Ric\",\"FirstDate\":\"2006-01-01T00:00:00.000Z\",\"LastDate\":\"2017-05-26T23:59:59.000Z\"}"],"KeepDuplicates":true}

Both doesnot work any Idea?

tick-history-rest-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.

Upvotes
Accepted
23k 22 9 14

Hi @bin

In Java, you may find the following code excerpt helpful

HttpPost httppost = new HttpPost(urlHost + "/Search/HistoricalSearch");    
	        httppost.addHeader("content-type", "application/json;odata.metadata=minimal");  
	        httppost.addHeader("Authorization", "Token "+sessionToken);        	          
	        JSONOrderedObject searchJSONObject = new JSONOrderedObject()
				        	.put("Request", new JSONOrderedObject()
							        .put("Identifier", "PETM.OQ")
						        .put("IdentifierType", "Ric")
						        .put ("Range", new JSONOrderedObject()
						        		.put("Start", "2000-09-29T00:00:00.000Z")
                     				    .put("End", "2017-09-29T00:00:00.000Z"))
						       
						        );

it produces the following result for me:

JSON response: {"@odata.context":"https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#Collection(ThomsonReuters.Dss.Api.Search.HistoricalSearchResult)",
"value":[{
"Status":"Valid",
"LastDate":"2015-03-14T00:00:00.000Z",
"Identifier":"PETM.OQ",
"Description":"Historical Instrument",
"DomainCode":"6",
"FirstDate":"2002-07-20T00:00:00.000Z",
"InstrumentType":"Unknown",
"History":[],"IdentifierType":"Ric","Source":"","Key":"...}]}

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
64 3 5 7

I change the code and now request to following code.

{"Identifiers":[{"@odata.type":"#ThomsonReuters.Dss.Api.Search.HistorcalSearchResult","Description":"Historical Instrument","Identifier":"PETM.OQ","IdentifierType":"Ric","FirstDate":"2006-01-01T00:00:00.000Z","LastDate":"2017-05-26T23:59:59.000Z"}],"KeepDuplicates":true}

I still got bad request?

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
64 3 5 7
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.

This query is a duplicate of this query which has an answer.

Upvotes
23k 22 9 14

Hi @bin,

I think you are looking to validate expired RICs

If yes, please refer to this answer

If you like to run HistoricSearch, I think you need HistoricalSearch, not HistoricSearchResult and date Range, for Search/HistoricalSerach description please refer to

REST API Reference Tree

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

@bin,

Perhaps you can try Search/HistoricalSearch

{
  "Request": {
    "Identifier": "PETM.OQ",
    "IdentifierType": "Ric",
    "Range": {
      "Start": "1996-01-01T00:00:00.000Z",
      "End": "2017-02-28T00:00:00.000Z"
    }
  }
}

that results in:

{
  "@odata.context": "https://hosted.datascopeapi.reuters.com/RestApi/v1/$metadata#Collection(ThomsonReuters.Dss.Api.Search.HistoricalSearchResult)",
  "value": [
    {
      "Identifier": "PETM.OQ",
      "IdentifierType": "Ric",
      "Source": "",
      "Key": "...",
      "Description": "Historical Instrument",
      "InstrumentType": "Unknown",
      "Status": "Valid",
      "DomainCode": "6",
      "FirstDate": "2002-07-20T00:00:00.000Z",
      "LastDate": "2015-03-14T00:00:00.000Z",
      "History": []
    }
  ]
}
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