Introducing more control over Site Streams with Control Streams

episod
@episod Taylor Singletary

Hi Developers,

I wanted to introduce a new set of features for our Site Streams beta consumers that I'm particularly excited about: Control Streams for Site Streams.

Control Streams is a suite of APIs for querying the current status of a site stream, adding & removing users from a site stream without reconnecting, and for obtaining information about the followings of specific users on a specific site stream. It has the added benefit of allowing you to load up to 1,000 users per stream, provided you add the additional users once the stream has already been established.

These new features are now available for all developers that are part of our Site Streams beta program and will be part of the final feature-set of Site Streams once it exits beta. Control Streams make it easier to manage large-scale Site Streams installations, and we recommend all current site stream consumers to utilize this new workflow as soon as possible.

Thank you to the "beta-inside-a-beta" developers who helped us ready control streams for wider usage in the past few months.

Please let us know if you have any questions about or issues with Control Streams below.

Thanks!

1 year 35 weeks ago

Replies

tapbot_paul
@tapbot_paul Paul Haddad

Do you guys suggest having 1000 users per stream at this point? And is there a recommendation on how many users can be added to a stream at a time? Can we do 900 or should it be done in batches?

1 year 35 weeks ago
episod
@episod Taylor Singletary

I recommend capping streams at 1,000 users and adding users to a stream in batches of 100, with 25 batches in parellel.

I would also like to do a visualization of this process inspired by and utilizing the Nintendo R.O.B. http://en.wikipedia.org/wiki/R.O.B.

1 year 35 weeks ago
cuppett
@cuppett Stephen Cuppett

Question about site streams. If multiple users in the site stream are all following a particular user (or are mentioned), will the site stream get duplicates of the status message, or will there just be one sent on the stream?

1 year 35 weeks ago
cuppett
@cuppett Stephen Cuppett

(I see the for_user parameter.) Just hoping that there's some kind of data volume benefit to site streams (versus just a connectivity one).

1 year 35 weeks ago
nosuz
@nosuz nosuz

Thank you for very interesting and usefull API methods.

I tried to use these new method, but the URL to get "followings of specific users" was not worked and got the next reply.

bad sitestream control command: followers/ids
stream updated

Is the end point '/2b/site/c/:stream_id/followers/ids.json' correct? It worked by changing 'followers/ids' to 'friends/ids' and the "Recent changes to this document" mentions as "stream_id/friends/ids.json".

1 year 34 weeks ago
episod
@episod Taylor Singletary

Thanks for pointing out this documentation bug; I'll get it fixed right away. Correct -- friends/ids.json is intended here.

1 year 33 weeks ago
jebui
@jebui Jebu Ittiachen

I keep getting a 401 Unauthorized response when trying to access the resource on the control uri. I'm accessing the endpoints using the user credentials with which I open the site stream connections. Anything special I should be doing to get access to these control uri resources?

1 year 31 weeks ago
episod
@episod Taylor Singletary

It sounds like you're doing the right thing -- are you able to use the REST API with OAuth fine typically? Are you using header-based OAuth? Can you give an example of both the URL and headers you're trying to send?

1 year 31 weeks ago
jebui
@jebui Jebu Ittiachen

I use query string based OAuth. All the REST API's work fine.

This GET works fine

http://api.twitter.com/1/account/verify_credentials.json?oauth_signature=tvR1ecpEu54wcM%2FPdKAAu98oLVE%3D&oauth_token=14472217-I38arIn6gMOYHFT4y13n6ygPkbbIR2QlLkDpfNO7g&oauth_version=1.0&oauth_nonce=1gDEXa3vxO2sbgpP0xec28iyxY%2B%2BvGxs04ucNqJjy%2Bw%3D&oauth_timestamp=1328150329&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=GgzauM2qvpu7nglP4qZF3Q

This GET fails
https://sitestream.twitter.com/2b/site/c/1_3140_34017225a737dc518ec0737c06d2d5b9afe0307c/info.json?oauth_signature=8Sy%2FpYXtePFkwAgARLaVghMvocY%3D&oauth_token=14472217-I38arIn6gMOYHFT4y13n6ygPkbbIR2QlLkDpfNO7g&oauth_version=1.0&oauth_nonce=s6FqE5IkCA7L%2F%2Fgw1NUmw1hsrT3BsAqPgePDcGzp8H8%3D&oauth_timestamp=1328150460&oauth_signature_method=HMAC-SHA1&oauth_consumer_key=GgzauM2qvpu7nglP4qZF3Q

This is the body of the response
\n<head>\n<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n<title>Error 401 Unauthorized</title>\n</head>\n<body>\n<h2>HTTP ERROR: 401</h2>\n<p>Problem accessing '/admin/controlproxy?oauth_signature=8Sy%2FpYXtePFkwAgARLaVghMvocY%3D&amp;oauth_token=14472217-I38arIn6gMOYHFT4y13n6ygPkbbIR2QlLkDpfNO7g&amp;oauth_version=1.0&amp;oauth_nonce=s6FqE5IkCA7L%2F%2Fgw1NUmw1hsrT3BsAqPgePDcGzp8H8%3D&amp;oauth_timestamp=1328150460&amp;oauth_signature_method=HMAC-SHA1&amp;oauth_consumer_key=GgzauM2qvpu7nglP4qZF3Q'. Reason:\n<pre>    Unauthorized</pre>\n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n                                                \n</body>\n\n\r\n

I dont send any extra headers on the requests.

1 year 31 weeks ago
jebui
@jebui Jebu Ittiachen

My response with the details you requested seems to be sitting in moderation queue. Should I resend it?

1 year 31 weeks ago
episod
@episod Taylor Singletary

Fixed.

The Streaming API, like most of our APIs, really works best with header-based OAuth. Can you switch to headers and see if that improves anything?

Are you sure you aren't sending any other kind of HTTP headers like the ones you'd typically expect to see in a full HTTP client?

1 year 31 weeks ago
jebui
@jebui Jebu Ittiachen

Yes it does work when I switch to header based OAuth.

I send the following standard headers on the query string request
te: \r\nhost: sitestream.twitter.com\r\nconnection: keep-alive\r\n

1 year 28 weeks ago
shubharahul
@shubharahul Shubha Kirani

On my company website we want to pull tweets from 'CompanyNews' id. I tried to pull the script for your WIdget genrator: 'https://twitter.com/about/resources/widgets/widget_profile'
But running into connection limit. What approach do you suggest ?

1 year 31 weeks ago
dtran320
@dtran320 David Tran
  1. {
  2.     "info":
  3.     {
  4.         "users":
  5.         [
  6.             {
  7.                 "id":119476949,
  8.                 "name":"oauth_dancer",
  9.                 "dm":false
  10.             }
  11.         ],
  12.         "delimited":"none",
  13.         "include_followings_activity":false,
  14.         "include_user_changes":false,
  15.         "replies":"none",
  16.         "with":"user"
  17.     }
  18. }

What does the replies field refer to? Can we subscribe to the replies of users' tweets in Site Streams?

Thanks,
David

1 year 31 weeks ago
GeneLamarEllis
@GeneLamarEllis Gene Ellis

Anyone have a PHP snippet of a Control Streams integration? Just want to compare integration strategies.

1 year 30 weeks ago
runciblejay
@runciblejay runciblejay

I am recv'ing a 413 response occasionally when sending exactly 100 users in an add_user request. The stream has less than 1k users total ( including those in add_user ). Any ideas?

HTTP 413: Request Entity Too Large

Parameter user_id has too many items specified

1 year 29 weeks ago
episod
@episod Taylor Singletary

Are you using a POST or a GET in that request? Make sure that you're passing the add_user parameter in the POST body -- if you're sure you are, let me know that too.

1 year 28 weeks ago