stream
Run a compiled filter.
https://api.datasift.com/stream
| Parameter: | Description: |
|
hash required |
A unique pointer to a compiled filter. You receive this hash when you call the /compile endpoint. Example values: 2459b03a13577579bca76471778a5c3d |
|
interaction_id optional |
The id of the first message you want to receive. These unique ids are assigned to interactions by DataSift. To find an interaction id, examine the interaction element in your JSON output. Example values: 1e10f949c51aab80e074df944f5e8e46 |
|
count optional |
The number of messages you want to receive (1 - 200). Example values: 42 |
All calls to the API must be properly authenticated with a DataSift username and API key.
Please note that this endpoint is intended primarily for testing purposes.
It does not guarantee to deliver every object from your stream and it cannot handle streams with a high throughput. If a stream delivers more than 20 objects per second, the /stream endpoint will pause for 10 to 15 seconds.
If you have an application where you need as near to real-time data delivery as possible, look at DataSift's Streaming API. Otherwise, recommend Push for data delivery because it offers the best guarantees and a wide range of delivery destinations.
1. Here's an example of a call to /stream. The username and api_key parameters are not shown but they are required.
https://api.datasift.com/stream
?hash=9fe133a7ee1bd2757f1e26bd78342458
Datasift returns this JSON:
2. Use count=1 to limit the result to one return object.
https://api.datasift.com/stream
?hash=2aa23bbf68889196d8880179c2ca61b3
&count=1
3. Notice that the return object in Example 1 includes an interaction_id.
You can use that in a subsequent API call. For example, suppose your first call to /stream returned 5 results and the interaction_id of the last result was 1e0b79ab27ccabe0e074278d41397262.
You can attempt to retrieve the next result by feeding that interaction_id into the next call to /stream:
https://api.datasift.com/stream
?hash=2aa23bbf684d9196d58b0179c2ca61b3
&interaction_id=1e0b79ab27ccabe0e074278d41397262
If the result is still in DataSift's buffer for that filter, you will receive it.
If it is no longer in the buffer, you receive the next available result. The buffer operates on a first in-first out basis.
