question

Upvotes
Accepted
64 3 9 11

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 512.0 KiB each and 1.0 MiB total.

Hi @bin. Thank you for your participation in the forum.

Is the reply below satisfactory in resolving your query?

If so please can you click the 'Accept' text next to the appropriate reply. This will guide all community members who have a similar 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

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 512.0 KiB each and 1.0 MiB total.

Upvotes
64 3 9 11

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 512.0 KiB each and 1.0 MiB total.

Upvotes
64 3 9 11
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.

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

Upvotes
32.2k 40 11 20

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 512.0 KiB each and 1.0 MiB total.

Upvotes
32.2k 40 11 20

@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 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.