/push/get requests without id return empty result set


#1

Hi Folks,

While looking for a programmatic method of retrieving my push API subscription ids, I found the /push/get method, which appears from the docs to do exactly what I need. However, I noticed that when I make the call, using either the push API console at https://console.datasift.com/datasift, or using a client library, I get the response:

{
“subscriptions”: [],
“count”: 0
}

Out of curiosity, I repeated the call but specified the ID of one of the subscription IDs I knew. When specifying the ID, the API returns the correct information, when using either the console or a client.

I’m using the default parameters for everything, and tried twiddling a few of the obvious ones to see if it changed anything. Am I missing anything obvious that needs to be done in order to retrieve the set of all push subscriptions?


#2

I assume you created your Push tasks via the UI; if you had created them via the API, you would have seen your tasks listed.
It is possible to list tasks created via the UI in the API if you pass the all=true parameter with your /push/get request


#3

That does the trick, although I found I had to patch the Datasift Python client library’s push.get() method to accept an include_all parameter.

The change is simple and for now I can fork the client library, but it’d be nice to have the official version support it as an option. However, since I only have a couple of Subscriptions that were created via the UI, I’m guessing that it’d probably make more sense for me to simply clone the subscriptions via the API . I’m guessing its also not trivially possible to toggle the visibility of the subscription?

Thanks!

.andy


#4

If you’d like to submit a pull request to the official repo, we’d be happy to review and merge your changes.
The reason this has not been included in the client library in the past is due to the fact that we recommend all work on your production application is done via the API rather than the UI; being able to access tasks created via the UI from the API is an edge case which we do not often see a need for. It’s not possible to make a subscription visible via the API’s /push/get list command without passing the all parameter, no.


#5

I think I like the approach you’re taking wrt subscription visibility, and since I only have a couple of subscriptions to worry about, I’m going to clone them using the API, and the information you provided about the “all” parameter was the key there- I was just feeling too lazy to assemble the json to reproduce the subscriptions by hand :smile:

Thanks, Jason!

.andy