'subscriptions' key instead of 'data' key in historics/get response


#1

After making a successful subscription, I hit the ‘get’ endpoint to get a list of my subscriptions. According to this page: http://dev.datasift.com/docs/api/1/historicsget, if I don’t mention and historic_id or max_value, it says I would get a json response with two keys. One called ‘data’ that has a list of my subscriptions and another called ‘count’ giving me the count of currently active subscriptions. However, what I got is a json with the fields ‘count’ and ‘subscriptions’.

The key ‘subscriptions’ has the list of my subscriptions.

Can you please confirm what is the expected nature of the response I receive from DataSift? I wrote my code to work with the key ‘data’ and it broke. If I change it to ‘subscriptions’ now, will it remain consistent throughout?

Following is the JSON that I got:

{
u’count’: 1,
u’subscriptions’:
[
{
u’status’: u’active’,
u’last_request’: None,
u’user_id’: ,
u’name’: u’name’,
u’output_params’: [],
u’created_at’: datetime.datetime(2014, 6, 4, 0, 10, 12),
u’end’: None,
u’interaction_count’: 0,
u’hash_type’: u’historic’,
u’remaining_bytes’: None,
u’start’: datetime.datetime(2014, 6, 4, 0, 10, 12),
u’last_success’: None,
u’lost_data’: False,
u’output_type’: u’pull’,
u’id’: u’’,
u’hash’: u’’
}
]
}

This above json does not seem to be similar to the ones you have mentioned in http://dev.datasift.com/docs/api/1/historicsget. For example, the key ‘last_request’ is not there in the docs.


#2

It looks like you may be getting your API calls mixed up.

/push/get will return a list of your Push subscriptions. You will receive a 'subscriptions' key in this response, containing a list of all Push subscriptions matching your query.

/historics/get will return a list of your Historics jobs. You will receive a 'data' key in this response, containing a list of all your Historics jobs matching your query.

You may want to read the Push API: Step by step guide to see an overview of how Push Subscriptions and Historics Queries are connected.


#3

My bad. When I skimmed through the source code for python-datasift library, I saw ‘get’ inside the Push class and decided that was the only ‘get’ to be used. I tried accessing the ‘get’ from within the historics class and now everything is working perfect.

Thanks a bunch!