Rest API


#1

Hi All,

I’m trying to figure out how I can search Tweets. I’m using the examples found in the docs and using the dev console for testing. Below are the steps I am doing to test, I’m pretty sure I should be getting some tweets back but unfortunately I’m not getting any:

  1. I'm using this rule: twitter.text contains_any "happy birthday, birthday, bday, b'day"
  2. On the console, I type this in in the csdl field under 'Validate a CSDL' and I get a successful response.
  3. I then add the same line in 'Compile a CSDL' and I get a hash back.
  4. I then copy and paste the hash in the 'Get stream interactions' hash field, leaving the other two fields as their default, I would expect to see some tweets returned but I get an empty "stream" back.

Am I missing some steps here? I have also tried compiling ‘twitter.text contains “apple”’ and ran that hash through ‘Get stream interactions’. Sometimes I would get tweets back and sometimes I wouldn’t. Any ideas on where I’m going wrong?

Thanks!


#2

The /stream endpoint is a 'live', buffered stream of Tweets. If the 'count' param is set to the default 200, nothing will be returned until DataSift has matched 200 Tweets. I think it is safe to assume that "Apple" is mentioned on twitter more frequently than "Happy Birthday", which would explain why you would sometimes receive a response for your Apple stream, and not for your Birthday stream. This buffered /stream endpoint is really for testing purposes only, and should not be used for any production systems.

You should look at using our live Streaming API, or Push Delivery architecture. You can play with the live Streaming API by clicking "Live Preview" or "Consume via API" after creating a stream via the UI. You also have the option to "record" the live stream via Push Delivery after creating a stream. You can create new destinations for your data to be pushed to under the Data Destinations tab in the UI.