The REST API has seen incredible adoption since it became generally available just two releases ago in Spring ’11, and the Streaming API, while still a pilot feature, looks set to follow the same curve. There are enhancements and tweaks to both in Winter ’12 – here are the details…

As Sandeep mentioned the other day, while the REST API has supported upload of binary data since its inception, the maximum blob size has been limited to 50 MB (after base64 encoding). Winter ’12 brings the ability to upload blobs of up to 500 MB via multipart messages. The multipart syntax is quite straightforward, and familiar to anyone who has looked at the raw source of email messages:

See the pre-release documentation for full details.

Turning to the Streaming API, the Winter ’12 iteration of the pilot brings some changes. One important change for anyone who has been working with Streaming in Summer ’11 is that the session token is now sent as an OAuth token in the HTTP Authorization header, rather than as a cookie.

This change brings Streaming into line with the REST API, and allows easier integrations, since JavaScript running in the browser is free to set the Authorization header, while cookies are off-limits.

Another key change in Winter ’12 is that subscribing applications must prefix the PushTopic name with "/topic/".

The net effect of these changes is that a JavaScript app using the jQuery CometD binding now connects and subscribes for updates thus:

The final significant change in Winter ’12 is that session timeouts are now restarted with every operation on the connection, rather than sessions having a maximum duration, regardless of activity. Again, full details can be found in the pre-release documentation.

One aspect of the Streaming API that remains the same in Winter ’12 is that it is still in limited pilot. If you want to get to grips with Streaming on, head on over to the Streaming API page and get with the program!

Get the latest Salesforce Developer blog posts and podcast episodes via Slack or RSS.

Add to Slack Subscribe to RSS