Closed paulorsr closed 8 years ago
Hello!
Do you have any historics in your account?
We've had that exception before in #73. If memory serves our API returned an empty {}
instead of []
.
If you have no historics this will help me narrow the issue down. Also if you're running this locally and can add a break point at https://github.com/datasift/datasift-java/blob/master/src/main/java/com/datasift/client/DataSiftApiClient.java#L39 - pasting the value of the variable s
would be great.
Thanks
Hello again! Thanks for you reply.
Yes I have historics, I can see the list through REST call https://api.datasift.com/v1.3/historics/get?username=<username>&api_key=<key>
. Running locally I can see that T instance is an instance of HistoricsQueryList class initialized with default values, s contains the JSON object with an array of HistoricsQuery objects and count = 167. In my unit test if I change the JSON response to start as array instead of object I can map it to HistoricsQueryList :|
Here's the incomplete content of s because it's a little too big containing 167 objects as you may check on count property: { "data": [ { "id": "49b52a2fa109efa5bca2", "definition_id": "18b84d03100c827605a9c1319c04da07", "name": "historic_2015-08-05_12-17-21", "start": 1438713191, "end": 1438754700, "created_at": 1438769841, "status": "succeeded", "progress": 100, "sources": [ "twitter", "facebook" ], "sample": 100, "estimated_completion": 1438775341, "delivery_count": 1472 }, { "id": "4c8f82c810668956ca7f", "definition_id": "e73916f4095033c4091062cce0986b29", "name": "historic_2015-08-05_11-25-16", "start": 1438713191, "end": 1438754700, "created_at": 1438766717, "status": "succeeded", "progress": 100, "sources": [ "twitter", "facebook", "tumblr" ], "sample": 100, "estimated_completion": 1438773414, "delivery_count": 21139 } ], "count": 167 }
On my unit test I loaded a JSON file with the following content and it deserialize correctly:
[ { "id": "49b52a2fa109efa5bca2", "definition_id": "18b84d03100c827605a9c1319c04da07", "name": "historic_2015-08-05_12-17-21", "start": 1438713191, "end": 1438754700, "created_at": 1438769841, "status": "succeeded", "progress": 100, "sources": [ "twitter", "facebook" ], "sample": 100, "estimated_completion": 1438775341, "delivery_count": 1472 }, { "id": "4c8f82c810668956ca7f", "definition_id": "e73916f4095033c4091062cce0986b29", "name": "historic_2015-08-05_11-25-16", "start": 1438713191, "end": 1438754700, "created_at": 1438766717, "status": "succeeded", "progress": 100, "sources": [ "twitter", "facebook", "tumblr" ], "sample": 100, "estimated_completion": 1438773414, "delivery_count": 21139 } ]
Hello, any news about this? Thanks
Fix pending in https://github.com/datasift/datasift-java/pull/109
Hello!
I'm trying to get a list of my datasift historics and I'm getting errors while deserializing an instance of HistoricsQueryList. I have the following unit test:
DataSiftConfig config = new DataSiftConfig("my_username", "my_key"); DataSiftClient datasift = new DataSiftClient(config); Stream stream = Stream.fromString("my_stream_hash"); HistoricsQueryList list = datasift.historics().list().sync();
I'm getting the following exception:
com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of com.datasift.client.historics.HistoricsQueryList out of START_OBJECT token at [Source: java.io.StringReader@78dcb136; line: 1, column: 1
Since HistoricsQueryList implements List I guess Jackson is expecting a JSON array instead of object from API.
Am I doing something wrong? Thanks!